Home › Forums › Ticket Products › Event Tickets Plus › Dynamic Pricing for Tickets
- This topic has 8 replies, 3 voices, and was last updated 12 years, 11 months ago by
Barry.
-
AuthorPosts
-
April 28, 2013 at 7:47 am #47057
Patrick
ParticipantMay I know is there a way to set different prices for one type of ticket based on the chosen amount?
Thanks!
April 29, 2013 at 7:47 am #47124Barry
MemberPossibly yes – but this would be something you’d have to handle through WooCommerce (whether by discounts or some other means), it’s not something the WooTickets facilitates by itself.
You can link to the WooCommerce product editor from each ticket by following the Edit in WooCommerce link 🙂
April 29, 2013 at 8:00 am #47127Patrick
ParticipantThanks Barry – I have tried to change it to a Variable product but to no avail. It seems that the only way to do it is via a paid plugin – Dynamic Pricing
April 30, 2013 at 12:18 am #47229George
ParticipantHi I am having similar problem, I want to use variable ticket, and I followed the “woocommerce edit link” on event edit screen under “ticket” meta box, and even though I have set variable product its listing only the simple product, and then I reviewed your code and I believe your code is not dynamic, its kind of hard coded to show only simple ticket (added on event page, under ticket metabox), so please have a look and fix it. I can work on that, but I don’t want to loose the leverage of receiving updates. 😀
April 30, 2013 at 10:21 am #47259Patrick
ParticipantHi @George,
Thanks for the precious info – do you mind sharing the code with me? 🙂May 10, 2013 at 8:54 am #48169Barry
MemberWe’ll leave this open for a few more days – however after that I’ll close this thread (it could be worth seeking help on a WooCommerce specific forum for this sort of question).
May 10, 2013 at 9:15 am #48188George
ParticipantThough my code mod* is specific to my needs, but you can still understand whats lacking in original code,
if ( class_exists( ‘WC_Product_Simple’ ) ) {
$product = new WC_Product_Simple( $ticket->ID );
} else {
$product = new WC_Product( $ticket->ID );
}
should be replaced with
$product = get_product($ticket->ID);and replace
echo “”;
if ( $product->is_in_stock() ) {
woocommerce_quantity_input( array( ‘input_name’ => ‘quantity_’ . $ticket->ID, ‘input_value’ => 0, ‘min_value’ => 0, ‘max_value’ => $product->backorders_allowed() ? ” : $product->get_stock_quantity(), ) ); $is_there_any_product_to_sell = true;
} else {
echo “” . esc_html__( ‘Out of stock!’, ‘tribe-wootickets’ ) . “”;
}
echo “”;with this (hack way but you can improvise and improve it),
echo “”;
remove_action(‘woocommerce_single_product_summary’, ‘woocommerce_template_single_title’, 5);
remove_action(‘woocommerce_single_product_summary’, ‘woocommerce_template_single_price’, 10);
remove_action(‘woocommerce_single_product_summary’, ‘woocommerce_template_single_excerpt’, 20);
//remove_action(‘woocommerce_single_product_summary’, ‘woocommerce_template_single_add_to_cart’, 30);
remove_action(‘woocommerce_single_product_summary’, ‘woocommerce_template_single_meta’, 40);
remove_action(‘woocommerce_single_product_summary’, ‘woocommerce_template_single_sharing’, 50);
echo do_action(‘woocommerce_single_product_summary’);
echo “”;also if you would like to modify
single-product/add-to-cart/simple.php
single-product/add-to-cart/variable.phpfor specifically on events ticket area (not standard product or shop pages),
I have modified these files and put them under
my-theme/events/woocommerce/*
by using this
global $woocommerce;add_filter(‘woocommerce_locate_template’, ‘tickets_locate_template’, 10, 3);
function tickets_locate_template($template, $template_name, $template_path) {
switch ($template_name) {
case ‘single-product/add-to-cart/simple.php’:
case ‘single-product/add-to-cart/variable.php’:
$template = get_template_directory() . ‘/events/woocommerce/’ . $template_name;
break;
}
return $template;
}
specifically on this template of wootickets (named tickets.php under views folder)Hope it helps, and @barry its not woocommerce related issue it relates your wootickets (its forcing single product on tickets, if follow woocommerce standards it should work without creating its own product loop (aka tickets in this case))
If still confused ping and I will try to make it clear.
May 10, 2013 at 9:26 am #48191Patrick
ParticipantThanks George – you are the man!
May 10, 2013 at 11:28 am #48225Barry
MemberGood stuff – and props to George there. I’ll go ahead and close this thread since it seems we’re all sorted here.
-
AuthorPosts
- The topic ‘Dynamic Pricing for Tickets’ is closed to new replies.
