• Resolved reemsafdar

    (@reemsafdar)


    Hi!

    I’m using woocommerce addon and I’ve woocommerce product on my course page, Can I replace it with add-to-cart button so students dont see the woocommerce product?

Viewing 1 replies (of 1 total)
  • @reemsafdar,

    This is a great question. I took a bit of time to figure out the best way to do this, sorry for my delay.

    Due to the way WooCommmerce handles variable products and variable subscriptions there doesn’t appear to be a simple way to variable products.

    However, you can do simple products pretty easily via this code snippet you can add to your functions.php file:

    
    add_filter( 'llms_wc_product_shortcode', 'my_llms_wc_product_shortcode', 10, 3 );
    
    function my_llms_wc_product_shortcode( $output, $llms_product, $wc_product_id ) {
    	return '[add_to_cart id="' . $wc_product_id . '"]';
    }
    

    I really tried to figure out the variable cart thing but I spent 30 minutes with no luck. Sorry…

    This might help for something custom though: https://www.remicorson.com/add-woocommerce-variable-product-with-variations-to-cart/

    Hope that helps,

Viewing 1 replies (of 1 total)
  • The topic ‘Woocommerce Product on Course Page’ is closed to new replies.