WooCommerce Single Product Checkout -
i'm in process of moving site on infusionsoft's singular order form pages (no cart, buy 1 product @ time) woocommerce powered site shopping cart. part going well.
however, there's circumstances client wants site behave infusionsoft checkout. basically... user goes url nothing checkout page specified product, thing can purchase. if doing class , offering special offer attendees (via custom url).
i've tried woocommerce single product checkout, , while gets close doesn't i'd want. 2 big issues 1) still requires user add item cart , 2) cart still site wide, meaning if user had added product cart checkout on single product page wants check both products out.
any suggestions? thanks
ended writing own plugin. here's code
function add_and_forward($atts, $content=null) { global $woocommerce; $ids = explode(",", $atts['product_ids']); $empty_cart = $atts['empty_cart']; $checkout_url = $woocommerce->cart->get_checkout_url(); //if empty cart if($empty_cart === "1") $woocommerce->cart->empty_cart(); foreach($ids $id) $woocommerce->cart->add_to_cart($id); wp_redirect( $checkout_url ); } add_shortcode('add_and_forward', 'add_and_forward');
only downside still site wide cart, client said ok, @ least gives them option empty users cart or not.
run following shortcode
[add_and_forward product_ids="1748" empty_cart="1"]
Comments
Post a Comment