Add_action not showing up on product page

This topic has 3 replies, 2 voices, and was last updated 2 years, 8 months ago ago by Ruben Budding

  • Avatar: Ruben Budding
    Ruben Budding
    Participant
    April 6, 2022 at 19:57

    I use the xstore with the product builder. only now I want to add an extra hook add_action above the add cart button. But this one doesn’t show up. what am i doing wrong here?

    add_action( ‘woocommerce_single_product_summary’, ‘ts_you_save’, 11 );

    2 Answers
    Avatar: Olga Barlow
    Olga Barlow
    Support staff
    April 7, 2022 at 01:04

    Hello,

    If you use the single product builder instead of the built-in layout then use one of the below hooks depending on your needs instead of the default WooCommerce hook
    etheme_woocommerce_template_single_excerpt
    etheme_woocommerce_template_single_add_to_cart

    Provide us with WP Dashboard and FTP access if you still have a problem with that.

    Regards

    Avatar: Ruben Budding
    Ruben Budding
    Participant
    April 7, 2022 at 09:13

    `Thanks thats works! 🙂 If there are other users this on product page: Save now would like to have hereby the code below

    //Save now: Price %Discount
    function ts_you_save() {

    global $product;

    if( $product->is_type(‘simple’) || $product->is_type(‘external’) || $product->is_type(‘grouped’) ) {

    $regular_price = get_post_meta( $product->get_id(), ‘_regular_price’, true );
    $sale_price = get_post_meta( $product->get_id(), ‘_sale_price’, true );

    if( !empty($sale_price) ) {

    $amount_saved = $regular_price – $sale_price;
    $currency_symbol = get_woocommerce_currency_symbol();
    $percentage = round( ( ( $regular_price – $sale_price ) / $regular_price ) * 100 );
    ?>

    Save now: €

  • Viewing 3 results - 1 through 3 (of 3 total)

The issue related to '‘add_action not showing up on product page’' has been successfully resolved, and the topic is now closed for further responses

Helpful Topics

We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.