Creating a button on the event page to link directly to WooCommerce Product Page

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.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1555466

    I 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?

    #1555617
    Patricia
    Member

    Hi 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

    #1555668

    Thanks Patricia,

    Do I also need to include the code line with ‘echo…below?? If so what do I put here?

    #1556105
    Patricia
    Member

    Hi 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 '

      ';
      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 "

    • $ticket->name $price $link
    • ";
      }
      if ( 0 === $count )
      echo '

    • There are no tickets available for this event
    • ';
      echo '

    ';

    I hope this helps! Let me know if you have any other questions in the meantime!

    Thanks,

    Patricia

    #1572800
    Support Droid
    Keymaster

    Hey 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

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Creating a button on the event page to link directly to WooCommerce Product Page’ is closed to new replies.