Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more

Update published_at on a product is not working if Variants has a Metafield (REST API)

Update published_at on a product is not working if Variants has a Metafield (REST API)

LarsB
Shopify Partner
1 0 0

Hi

 

I need to update the published_at via the REST endpoint.

If I call the endpoint with Metafield in the Variant section, it doesn't update the published_at. If I remove the Metafield it works fine. Is this a bug in the endpoint or any ideas?

With Metafield:

{
    "product": {
        "body_html": "<ul><li>Sized to fit the twist-on...</li></ul>",
        "id": "123456789",
        "metafields": [
            {
                "description": "",
                "id": "22336917608621",
                "key": "LENGTH",
                "namespace": "global",
                "type": "single_line_text_field",
                "value": "4"
            }
        ],
        "options": [
            {
                "name": "Finish"
            }
        ],
        "published_at": null,
        "published_scope": "global",
        "tags": "Trucks,Wheels",
        "title": "Spike Nut...",
        "variants": [
            {
                "barcode": "",
                "fulfillment_service": "manual",
                "grams": "0.00",
                "inventory_management": "shopify",
                "inventory_policy": "deny",
                "metafields": [
                    {
                        "description": "",
                        "key": "finish",
                        "namespace": "custom",
                        "type": "single_line_text_field",
                        "value": "Chrome"
                    }
                ],
                "option1": "Chrome",
                "product_id": "123456789",
                "requires_shipping": true,
                "taxable": true,
                "weight": "3.00",
                "weight_unit": "lb"
            },
            {
                "barcode": "",
                "fulfillment_service": "manual",
                "grams": "0.00",
                "inventory_management": "shopify",
                "inventory_policy": "deny",
                "metafields": [
                    {
                        "description": "",
                        "key": "finish",
                        "namespace": "custom",
                        "type": "single_line_text_field",
                        "value": "Black"
                    }
                ],
                "option1": "Black",
                "product_id": "123456789",
                "requires_shipping": true,
                "taxable": true,
                "weight": "2.00",
                "weight_unit": "lb"
            }
        ]
    }
}

Without Metafield:

{
    "product": {
        "body_html": "<ul><li>Sized to fit the twist-on...</li></ul>",
        "id": "123456789",
        "metafields": [
            {
                "description": "",
                "id": "22336917608621",
                "key": "LENGTH",
                "namespace": "global",
                "type": "single_line_text_field",
                "value": "4"
            }
        ],
        "options": [
            {
                "name": "Finish"
            }
        ],
        "published_at": null,
        "published_scope": "global",
        "tags": "Trucks,Wheels",
        "title": "Spike Nut...",
        "variants": [
            {
                "barcode": "",
                "fulfillment_service": "manual",
                "grams": "0.00",
                "inventory_management": "shopify",
                "inventory_policy": "deny",
                "option1": "Chrome",
                "product_id": "123456789",
                "requires_shipping": true,
                "taxable": true,
                "weight": "3.00",
                "weight_unit": "lb"
            },
            {
                "barcode": "",
                "fulfillment_service": "manual",
                "grams": "0.00",
                "inventory_management": "shopify",
                "inventory_policy": "deny",
                "option1": "Black",
                "product_id": "123456789",
                "requires_shipping": true,
                "taxable": true,
                "weight": "2.00",
                "weight_unit": "lb"
            }
        ]
    }
}
Replies 0 (0)