• Resolved Mikey

    (@mikeyhash)


    Hi,

    By default, adding a product will store a bunch of lines in postmeta.

    Depending on what the e-commerce website is about and on what you are selling, a lot of the meta has absolutely no use.

    In my particular case, (at least) the stuff below is totally useless:

    '_tax_status',
    '_tax_class',
    '_weight',
    '_length',
    '_width',
    '_height',
    '_upsell_ids',
    '_crosssell_ids',
    '_purchase_note',
    '_virtual',
    '_downloadable',
    '_download_expiry',
    '_wc_rating_count',
    '_wc_average_rating',
    '_wc_review_count',

    As you can see, there are A LOT of rows in wp_postmeta table that are not needed, inserted with each new product.

    So basically I have 2 questions:

    1) Why can’t you improve this? For instance, most of the meta keys should be saved in db ONLY if there is a value inserted (like weight, height, etc.).

    2) Why is _tax_class considered a must? Maybe this way I could better understand the bigger picture (if there is any).

    Here’s the corresponding function in WC’s file:

    /**
    * Meta data which should exist in the DB, even if empty.
    *
    * @since 3.6.0
    *
    * @var array
    */
    protected $must_exist_meta_keys = array(
    	'_tax_class',
    );

    Throughout the years, you’ve received similar complaints from people with very large postmeta tables. I’ve read a lot of discussions on github and you somehow acknowledge this matter, yet you haven’t done anything about it.

    Is there a logical explanation for this?

    Thank you.

Viewing 3 replies - 1 through 3 (of 3 total)
  • ‘_tax_status’,
    ‘_tax_class’,
    ‘_weight’,
    ‘_length’,
    ‘_width’,
    ‘_height’,
    ‘_upsell_ids’,
    ‘_crosssell_ids’,
    ‘_purchase_note’,
    ‘_virtual’,
    ‘_downloadable’,
    ‘_download_expiry’,
    ‘_wc_rating_count’,
    ‘_wc_average_rating’,
    ‘_wc_review_count’,

    mother.of.code

    (@imazed)

    The Mother of Code

    Hey @roxy5280, this is best discussed with the core developers over at GitHub. If you have already found issues that relate to this, the best approach is to add your question there.

    Thank you!

    mother.of.code

    (@imazed)

    The Mother of Code

    Hey Mikey, I’d very much appreciate it if you remain respectful to everyone involved. I tagged the other user by accident – the answer remains the same.

    • This reply was modified 4 years, 9 months ago by mother.of.code. Reason: Had to add a part
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Unnecessary product postmeta’ is closed to new replies.