• Resolved Flamekebab

    (@flamekebab)


    I’ve got loads of products created during the 1.x era of Jigoshop and the migration script did a fairly awful job of porting them. I’m still finding products with issues seven months later.

    In essence the problem is that products that are out of stock do not have their stock_status value set correctly in the wp_postmeta table. It should have been set to 0 by the migration script but it wasn’t.

    As a result they show up in catalogue view even though they can’t be bought. The setting to hide out of stock products is enabled but ignores these products.

    Opening one to edit in WordPress and hitting save updates the values and fixes the problem. That’s fine but not so much when there’s 500+ products that may be affected!

    Weirdly accessing the product data via the Jigoshop API incorrectly reports the value of stock_status.

    For example, product ID 1763, according to the API:

    "stock": {
    "manage": true,
    "status": 0,
    "allow_backorders": "no",
    "stock": 0
    },

    According the MySQL though…
    mysql> SELECT * FROMwp_postmetaWHEREpost_id= 1763 ANDmeta_key` LIKE ‘stock_status’;
    +———+———+————–+————+
    | meta_id | post_id | meta_key | meta_value |
    +———+———+————–+————+
    | 11572 | 1763 | stock_status | 1 |
    +———+———+————–+————+
    1 row in set (0.00 sec)`

    So what’s going on there then, guys?

Viewing 1 replies (of 1 total)
  • Thread Starter Flamekebab

    (@flamekebab)

    I can’t edit the post but here’s the mysql output with the code formatting:

    mysql> SELECT *  FROM wp_postmeta WHERE post_id = 1763 AND meta_key LIKE 'stock_status';
    +---------+---------+--------------+------------+
    | meta_id | post_id | meta_key     | meta_value |
    +---------+---------+--------------+------------+
    |   11572 |    1763 | stock_status | 1          |
    +---------+---------+--------------+------------+
    1 row in set (0.00 sec)
Viewing 1 replies (of 1 total)
  • The topic ‘API reports stock_status incorrectly [Potential Bug]’ is closed to new replies.