Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter Andrés Patiño

    (@andresf1395)

    I’m trying this:

    function override_position_giftcard() {
        remove_action( 'woocommerce_single_product_summary', array( $this, 'show_gift_card_product_template'), 60 );
        add_action( 'woocommerce_after_single_product_summary', array( $this, 'show_gift_card_product_template'), 61);
     }
    add_action( 'init' , 'override_position_giftcard' , 10 );
    

    In my function.php of the child theme, but doesn’t take effect

    • This reply was modified 4 years, 5 months ago by .

    Hello there,
    hope you are doing well!

    The only way to change that form is by changing the template called gift-card.php located in:
    \wp-content\plugins\yith-woocommerce-gift-cards\templates\single-product\add-to-cart

    There are some custom actions that you could change in order to display them as you want.

    Have a nice day!

    Thread Starter Andrés Patiño

    (@andresf1395)

    Hi Hector, thank’s for your reply.

    It is clear to me what you mention, however I don’t need to modify the fields of the form, but all its position to a different hook.

    What I want is that it is not under the price, but it appears outside the single product summary, so I try to change the hook to woocommerce_after_single_product_summary.

    I can’t overwrite it in my child theme, but if I go to the original plugin file in the path: yith-woocommerce-gift-cards/lib/class-yith-ywgc-frontend. php and modify line 74:

    add_action( 'woocommerce_single_product_summary', array( $this, 'show_gift_card_product_template' ), 60 );

    to this:

    add_action( 'woocommerce_after_single_product_summary', array( $this, 'show_gift_card_product_template' ), 60 ) );

    I get what I need.

    But I need to do it outside of the original files, to avoid breaking it in an update.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Move position of the Hook’ is closed to new replies.