0

Scenario:

  • Add an Exp-resso Store Product field to an existing channel field group.
  • Populate the product data for every entry in that channel.
  • Delete the store custom field from the channel field group

The Problem

Store still thinks these products exist. They still show up in the Inventory page and the old entries (that used to have a product field) show up in all the "match product" fields for setting up discounts, etc..

Why

When deleting the store custom field from the channel field group, it seems that the corresponding entries in the Exp-resso Store Products database table should be deleted too, but they are not.

Question

Is there a way to remove a Store Custom Field from a Channel Field Group that will cause the corresponding entries in the Store Products database table to be deleted?

  • What version of Exp-resso Store are you running? – Parscale Jul 14 '14 at 18:35
  • EE 2.8.1, Store 2.3.1. – Anthony Stauffer Jul 16 '14 at 3:56
1

Unfortunately there aren't any EE hooks which run when a channel or channel field is deleted, so there is no easy way for Store to clean these up.

You could do it yourself in the database using a SQL query like this:

delete from exp_store_products
where entry_id not in (
    select entry_id from exp_channel_titles
)
  • Interesting to know. This brings up a host of other questions about orphaned data, but I'll post another topic for that. – Anthony Stauffer Jul 22 '14 at 3:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.