• Hi, I want the sidecart to open after adding to cart on this non-woocommerce page, but I can’t get it to work. Is there any script/change we can make so it will work?

    It is a variable product and this is what the ajax call processes

    $product_id = $_POST['product_id'];
    	$variation_id = $_POST['variation_id'];
    	$maat = $_POST['maat'];
    	$aantal = $_POST['aantal'];
    	global $woocommerce;
    	$varr['attribute_pa_maat'] = $maat;
    	$woocommerce->cart->add_to_cart($product_id,$aantal,$variation_id,$varr,null);

    And the ajax call

    $.ajax({
    			    type: "POST",
    			    url: themedir+"/add_to_cart.php",
    			    data: {
    			    	product_id : product_id,
    			    	variation_id : variation_id,
    			    	aantal : aantal,
    			    	maat : maat,
    			    	nonce : nonce
    			    	}, 
    			    cache: false,
    			    success: function(rets){
    				window.location.href = site_url+"/?atc=1";	
    			    	},
    			    });

    Thanks!

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

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author xootix

    (@xootix)

    Hello,

    Seems to be working fine now.

    Thread Starter Michel Schonhage

    (@jun-e-jay)

    Hi, it works now, after you click the “verder winkelen” link, but we want it to automatically open after we click the add to cart button (not after page reload and clicking on the “verder winkelen” link.

    Any suggestions? I could set up a staging environment where we remove the popup so you/we can test without it?

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    @jun-e-jay Please don’t offer to send or post logon credentials on these forums:

    https://www.ads-software.com/support/guidelines#the-bad-stuff

    You can contact the author on their own site and, once there, the discussion is between the two of you. However, it is not OK to enter or send site credentials on these forums. We don’t want to encourage others (who are less reputable) to do similar things. It’s a fine line, but one that we need to enforce. Thanks for your cooperation.

    Plugin Author xootix

    (@xootix)

    Hello @jun-e-jay

    For that you need to properly execute add to cart functionality.
    You need to return cart fragments as response and then on success, you need to call woocommerce event “added_to_cart”.
    Plugin also has inbuilt ajax add to cart functionality. For that to work, your HTML should look like

    <form class="cart">
    <input type="hidden" name="product_id" value="10500">
    <input type="hidden" name="variation_id" value="10502">
    <input type="hidden" name="qty" value="1">
    <button type="submit" name="add-to-cart" value="10500">Add to cart</button>
    </form>
    
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Sidecart on non-WooCommerce page’ is closed to new replies.