#StackBounty: #8 #commerce How can I programatically add a shipping method to a store?

Bounty: 100

I am using Commerce with Marketplace, and am using the Shipping module.

In my commerce marketplace, users become sellers via a custom form, where I create the store entity on submit. Currently, to attach a shipping method, it has to be done in commerce admin via a checkbox:

Shipping method admin screen

My marketplace can have an unlimited number of stores, making management of them via checkboxes unfeasible. How can I add a shipping method to a store? There’s a table commerce_shipping_method__stores:

enter image description here

Can I simply make an insert into this table and set the stores_target_id value to the new store id after the new store is created?


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.