Jump to content

[CODE] Delete a product from a specific shop (multishop)

Toni Mármol

Recommended Posts



I'm coding a little script to fix some issues on my multishop scenary and I need if there is a function to delete a product from a specific shop.


For example, I need something like this:


Product::delete($id_product, $id_shop);


... and this function must delete the rows in all tables related:








Is there any function? Or how can I do it?


Thanks in advance.

Link to comment
Share on other sites

Finally, I solved this with this code:





$id_lang = 1;
$id_product = 3622;
$id_shop = 11;

$product = new Product($id_product, null, $id_lang, $id_shop, Context::getContext()->shop->setContext(Shop::CONTEXT_SHOP, $id_shop));

if ($product->delete())
echo "Product $id_product deleted from shop $id_shop";

Edited by anmaral79 (see edit history)
Link to comment
Share on other sites

  • 1 year later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...