Home › Forums › Calendar Products › Events Calendar PRO › Creating a button on the event page to link directly to WooCommerce Product Page
- This topic has 3 replies, 2 voices, and was last updated 7 years, 9 months ago by
subsgrowthunleashed.co.uk.
-
AuthorPosts
-
June 18, 2018 at 8:45 am #1555466
subsgrowthunleashed.co.uk
ParticipantI have followed the instructions as set out in: https://theeventscalendar.com/knowledgebase/selling-tickets-from-the-woocommerce-products-page/ to edit our event page so that we link directly to the Woo Commerce Product Page (as we intend to use the Woo Commerce add-on to control Min/Max Order Quantities for a Variable Product).
The code and instructions to edit the theme functions.php work fine but we want to link to the relevant product pages from within the single event page by using a button instead of a hyperlink.
Can you let us know what we need to do to achieve this please?
June 18, 2018 at 12:18 pm #1555617Patricia
MemberHi there,
Thank you for reaching out to us!
You can achieve what you want by simply replacing:
$link = 'get_permalink() . '">Buy!';with:
$link = 'get_permalink() . '">Buy!';You can also use the tribe-button class to get a similar result.
I hope this helps! If you have any other questions at all please feel free to let me know and I’d be happy to help as best I can!
Cheers,
Patricia
June 18, 2018 at 1:29 pm #1555668subsgrowthunleashed.co.uk
ParticipantThanks Patricia,
Do I also need to include the code line with ‘echo…below?? If so what do I put here?
June 19, 2018 at 7:13 am #1556105Patricia
MemberHi there,
No need to change the echo bellow: the description will still be displayed as a list, but the hyperlink will be displayed as a button (here’s a screenshot with the result).
The complete snippet is:
$count = 0;
echo '- ';
- $ticket->name $price $link
- There are no tickets available for this event
foreach ( $tickets as $ticket ) {
global $product;
$count++;
if ( class_exists( 'WC_Product_Simple' ) ) $product = new WC_Product_Simple( $ticket->ID );
else $product = new WC_Product( $ticket->ID );
$price = $product->get_price_html();
$link = 'get_permalink() . '">Buy!';
echo "";
}
if ( 0 === $count )
echo '';
echo '';
I hope this helps! Let me know if you have any other questions in the meantime!
Thanks,
Patricia
July 11, 2018 at 9:35 am #1572800Support Droid
KeymasterHey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.
Thanks so much!
The Events Calendar Support Team -
AuthorPosts
- The topic ‘Creating a button on the event page to link directly to WooCommerce Product Page’ is closed to new replies.
