• Resolved sahithk

    (@sahithk)


    I need to change the position of tabby promo in single product page after add to cart or any position

Viewing 1 replies (of 1 total)
  • Plugin Author tabbyai

    (@tabbyai)

    Dear @sahithk

    Thank you for your question. Our developer has provided the following instructions to adjust the position of the Tabby promo snippet on the single product page:

    1. Current Placement:
      By default, the snippet is added in the file includes/class-wc-tabby-promo.php on line 6 using the action:
      add_action('woocommerce_before_add_to_cart_form', array( CLASS, 'product_promotion') );
      In WooCommerce templates (e.g., woocommerce/templates/single-product/add-to-cart/simple.php), this corresponds to the following hook:

      <?php do_action( 'woocommerce_before_add_to_cart_form' ); ?>
    2. Removing the Snippet from the Current Position:
      To remove the snippet from this default position, add the following code to the functions.php file in your theme:
      add_action( 'plugins_loaded', 'move_tabby_product_promotion' ); function move_tabby_product_promotion() { if (class_exists('WC_Tabby_Promo')) { remove_action('woocommerce_before_add_to_cart_form', array( 'WC_Tabby_Promo', 'product_promotion') ); } }
    3. Adding the Snippet to a Custom Position:
      To display the Tabby promo in a different position, use the following steps:
      Add this line to your desired template location:
      <?php do_action( 'tabby_product_promotion' ); ?>

      Then, in the functions.php file of your theme, add:
      add_action('tabby_product_promotion', array( 'WC_Tabby_Promo', 'product_promotion'));

      For example, your functions.php file would look like this:
      add_action( 'plugins_loaded', 'move_tabby_product_promotion' ); function move_tabby_product_promotion() { if (class_exists('WC_Tabby_Promo')) { remove_action('woocommerce_before_add_to_cart_form', array( 'WC_Tabby_Promo', 'product_promotion') ); add_action('tabby_product_promotion', array( 'WC_Tabby_Promo', 'product_promotion')); } }

      If you have any further questions kindly contact [email protected]

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.