Site logo

Archived topic

Shopping cart in header showing price with applied couon?

1 reply · Started by Éva on December 27, 2021

Viewing posts 1–2 of 2

Hi Team,

Hope you had a wonderful holiday :-)
Quick question. Is it possible that the cart in the header shows the price with a coupon applied? With the default settings I can see only the full price, however I would love it if it was possible that it would reflect any applied coupons.

Thank you so much for your help.
Regards
Éva

Hi Éva,

It's possible but this will require a plugin that can actually fetch the discounted price by coupon and be displayed in place of the default GP Premium cart.

You'll need something like this PHP snippet:

This one removes the default GP premium cart and adds a custom one depending on what you've added as callback function

add_action( 'wp', function() {
    remove_action( 'generate_menu_bar_items', 'generate_wc_do_cart_menu_item', 5 );
    add_action('generate_menu_bar_items', 'gp_woo_custom_cart', 5 );
} );

And then you can create a sample function like this where you can add the replacement cart.

function gp_woo_custom_cart(){
	//do your plugin's shortcode for displaying cart here.
}

Here's how to add PHP - https://docs.generatepress.com/article/adding-php/

This archived topic is closed to new replies.