Page 1 of 1

Bulk editing the 'requires shipping' option for products in a category

Posted: Wed Jul 11, 2018 5:20 pm
by lukeketchum1
Hey guys,

I am using OpenCart 3 and have been adding products to my store for a few weeks.

I added about 200 products which are digital, and do not require shipping, in all my wisdom I didn't change it from 'yes' to 'no' on requires shipping bit.

Is there a way of doing this in bulk to save me a) some time in the future b) some rsi

Any help appreciated, thank you

Luke

Re: Bulk editing the 'requires shipping' option for products in a category

Posted: Wed Jul 11, 2018 5:45 pm
by kestas
Hi you simply can make it in your phpmyadmin. Select and open your database, click SQL tab and paste this code:

Code: Select all

UPDATE oc_product
    SET shipping = 0
and click GO

Please check prefix of your table. Default "oc_"
This code will change the "Requires Shipping" -> "No" all of your products.
Important !!! Before you start this step, make a backup of the database.
Cheers

Re: Bulk editing the 'requires shipping' option for products in a category

Posted: Wed Jul 11, 2018 6:00 pm
by lukeketchum1
thanks for your reply! is there a way to do that for only products in one selected category?

Re: Bulk editing the 'requires shipping' option for products in a category

Posted: Wed Jul 11, 2018 7:17 pm
by kestas
ok, you need use INNER JOIN...
use this code to set shipping not required by category:

Code: Select all

UPDATE oc_product p
INNER JOIN oc_product_to_category ptc
ON ptc.product_id = p.product_id
SET p.shipping = 0
WHERE ptc.category_id = 24
change "24" from my example to your desired category number where your products should be without shipping.

of course do not forget to make backup of your database!!!

Cheers

Re: Bulk editing the 'requires shipping' option for products in a category

Posted: Wed Jul 11, 2018 8:38 pm
by lukeketchum1
Wow, it actually worked. 214 lines updated. And the site hasn't exploded yet. Thank you very much! :-D

Re: Bulk editing the 'requires shipping' option for products in a category

Posted: Thu Jul 12, 2018 7:22 pm
by paulfeakins
lukeketchum1 wrote:
Wed Jul 11, 2018 8:38 pm
Wow, it actually worked. 214 lines updated. And the site hasn't exploded yet. Thank you very much! :-D
Give it time.

Just kidding :crazy:

Re: Bulk editing the 'requires shipping' option for products in a category

Posted: Thu Jul 12, 2018 8:29 pm
by lukeketchum1
Haha thats the spirit ;-)

Re: Bulk editing the 'requires shipping' option for products in a category

Posted: Thu Jul 12, 2018 8:39 pm
by kestas
paulfeakins wrote:
Thu Jul 12, 2018 7:22 pm
lukeketchum1 wrote:
Wed Jul 11, 2018 8:38 pm
Wow, it actually worked. 214 lines updated. And the site hasn't exploded yet. Thank you very much! :-D
Give it time.

Just kidding :crazy:
Unfortunately, we will not see if it does :crazy: