Syntax error in snippet
-
Hi all. A developer for a plugin I’m using on my site sent me a code snippet and told me to add it to my functions.php file. When I did, I received an error stating I had a syntax error that ultimately crashed my site. I was able to remove it but I still have the issue I needed to remedy in the first place.
The snippet was supposed to fix the cart behavior on my shop pages. Right now, when a customer hits Return to Shop button, they return to the website Shop page instead of to the individual Seller Page they were originally shopping on.
Hoping someone can see the syntax error and advise on how to fix with my thanks.add_filter( \'woocommerce_return_to_shop_redirect\', function($shop_url) { if(is_cart() && wc()->cart->cart_contents_count == 0) { $deleted_items = wc()->cart->get_removed_cart_contents(); $deleted_items = array_reverse($deleted_items); foreach($deleted_items as $deleted_item) { $deleted_id = (int) $deleted_item[\'product_id\']; $vendor_id = wcfm_get_vendor_id_by_post($deleted_id); if($vendor_id) { return wcfmmp_get_store_url($vendor_id); } } } return $shop_url; });
The page I need help with: [log in to see the link]
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Syntax error in snippet’ is closed to new replies.