Comments on: How to update existing WooCommerce cart meta data https://pluginrepublic.com/how-to-update-existing-woocommerce-cart-meta-data/ WooCommerce Plugins Sun, 16 Jul 2023 02:16:57 +0000 hourly 1 By: Ben https://pluginrepublic.com/how-to-update-existing-woocommerce-cart-meta-data/#comment-194789 Sun, 16 Jul 2023 02:16:57 +0000 https://pluginrepublic.com/?p=32413#comment-194789 In reply to Gareth.

Hi Gareth,

I think she didn’t mean how to add a snippet to her site, but which filter or action to use to trigger this function. At least, that would be my question. 😉

Thanks a lot for all your work!
Ben

]]>
By: Gareth https://pluginrepublic.com/how-to-update-existing-woocommerce-cart-meta-data/#comment-74744 Thu, 19 Mar 2020 21:24:53 +0000 https://pluginrepublic.com/?p=32413#comment-74744 In reply to Allixria.

Hi Allixria

Here’s how to add a snippet to your site: https://pluginrepublic.com/documentation/how-to-add-a-code-snippet-to-your-site/

Thanks

Gareth

]]>
By: Allixria https://pluginrepublic.com/how-to-update-existing-woocommerce-cart-meta-data/#comment-74700 Thu, 19 Mar 2020 18:12:52 +0000 https://pluginrepublic.com/?p=32413#comment-74700 Where would be the safest place to call this function?

Thanks!

]]>
By: Gareth https://pluginrepublic.com/how-to-update-existing-woocommerce-cart-meta-data/#comment-54182 Sat, 21 Dec 2019 10:34:52 +0000 https://pluginrepublic.com/?p=32413#comment-54182 In reply to Waleed.

Hi – when you say it’s not working, are you getting an error message?

]]>
By: Waleed https://pluginrepublic.com/how-to-update-existing-woocommerce-cart-meta-data/#comment-53835 Thu, 19 Dec 2019 16:34:10 +0000 https://pluginrepublic.com/?p=32413#comment-53835 Hi Gareth,

I’ve tried to use the same analogy to change a product price in cart but it is not working, is it something related to wordpress new version or my code?

$cart = WC()->cart->get_cart_contents();
foreach( $cart as $key => $value ) {
$value[‘data’]->name = $value[‘data’]->name . ‘ – Paid ‘ . $term;
$value[‘data’]->set_price = $cost/$users;
WC()->cart->cart_contents[$key] = $value;
}
WC()->cart->set_session();

]]>
By: Gareth https://pluginrepublic.com/how-to-update-existing-woocommerce-cart-meta-data/#comment-24298 Sat, 15 Jun 2019 08:02:16 +0000 https://pluginrepublic.com/?p=32413#comment-24298 In reply to Ali.

This is how WooCommerce saves cart data.

]]>
By: Ali https://pluginrepublic.com/how-to-update-existing-woocommerce-cart-meta-data/#comment-24296 Sat, 15 Jun 2019 07:42:38 +0000 https://pluginrepublic.com/?p=32413#comment-24296 this is great, but one more question, why have you not explained what would we need to do in case we have not used sessions to store data?

]]>