• Hello,

    We are trying out the WCK Fieldsets plugin for one of our product ranges. So far, we are quite enjoying it. However, we ran into a small problem with the price total being displayed on the bottom. (after the short product description)

    We are looking into a way to display the price total of the product the same as the rest of our product catalog, (before the short product description) and would kindly appreciate help with that.

    The page I need help with: [log in to see the link]

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Krzysztof Pi?tkowski

    (@wckalkulator)

    @dirimmedia Hi, to change price block you should remove actions https://github.com/piatkowski/wckalkulator/blob/master/src/FieldsetProduct.php#L923

    For example in your functions.php:
    remove_action('woocommerce_after_add_to_cart_button', array(\WCKalkulator\Woocommerce\Product::class, 'price_block'));

    and then add action:

    add_action('your_hook_before_short_description', array(\WCKalkulator\Woocommerce\Product::class, 'price_block'));

    You need to add do_action(your_hook_before_short_description') by yourself, because woocommerce has only ‘woocommerce_before_add_to_cart_form’ and ‘woocommerce_single_product_summary’ which may not be what you want.

    Thread Starter dirimmedia

    (@dirimmedia)

    Hi @wckalkulator,

    we managed to move forward.

    add_action('woocommerce_single_product_summary', array(\WCKalkulator\Woocommerce\Product::class, 'price_block'));

    did the trick. Afterwards, we ran into the issue of “Total” being displayed in the bottom (before add to cart) despite, adding the remove_action to the functions.php.

    Is there a workaround for it, or did we do something wrong?

    Thanks in advance!

    Plugin Author Krzysztof Pi?tkowski

    (@wckalkulator)

    Try remove_action with woocommerce_before_add_to_cart_button.

    remove_action('woocommerce_before_add_to_cart_button', array(\WCKalkulator\Woocommerce\Product::class, 'price_block'));

    Thread Starter dirimmedia

    (@dirimmedia)

    We tried using the suggested action,

    remove_action('woocommerce_before_add_to_cart_button', array(\WCKalkulator\Woocommerce\Product::class, 'price_block'));

    but the issue persisted.

    Hi @dirimmedia , have you found a solution (repositioning or deletion) for the <p>Total</p> being displayed in the wrong position when the calculation field is moved? I’m encountering the same issue now.

    Thanks!

    Thread Starter dirimmedia

    (@dirimmedia)

    Hi @samganti we managed to fix our problem with the following function. It removed the extra total that was being displayed, and moved it under the product title.

    
    function wck_custom_price_block(){
    
            remove_action(
                'woocommerce_before_add_to_cart_button',  
                array('WCKalkulator\Woocommerce\Product', 'price_block')
            );
    
            remove_action(
                'woocommerce_after_add_to_cart_button',   
                array('WCKalkulator\Woocommerce\Product', 'price_block')
            );
    	 add_action('woocommerce_single_product_summary', array(\WCKalkulator\Woocommerce\Product::class, 'price_block'));
        }
    }
    add_action( 'wp_enqueue_scripts', 'wck_custom_price_block', 20 );
    • This reply was modified 1 year, 11 months ago by dirimmedia.

    Hi @dirimmedia, thanks a lot for your help, much appreciated! You just saved my day :-).

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Display price total on different position’ is closed to new replies.