Add lf-remove-product to the Upsell shortcode


It could be really useful to have the option to remove a product using the Upsell shortcode by adding the new string.

The shortcode would look like this:

lf-upsell product=”1234″ next=”5678″ accept=”Yes, I Want It!” decline=”No Thanks…” image=”yes” title=”yes” price=”yes” remove-product=”4321″

This product removal would be applied only if they accept the offer.


One Comment

  1. Hi Ellen, I was thinking about this one… it’s tricky. So I’m going to decline it in favor of other suggestions.

    In order to remove a specific product by ID requires the code to first loop through all products in the cart and identify the parent product, then get the wrapper around it to generate the removal link. This is compounded by variation products, which have a parent id vs. variation id, etc.

    A much easier method would be to setup your upsell product as a solo checkout or to clear the cart entirely before adding a new array of upsell product(s) (using for example our instant simple product bundle syntax).

    For example: you could just create a custom upsell offer with your page builder and on the button or link to accept the new product, you can add the url parameter for the LF Empty Cart function which is &emptycart=yes, so for example: /something?add-to-cart=1234&emptycart=yes

    See here for reference:

Leave a Reply