【问题标题】:Shopify send product with options on shopifyShopify 在 shopify 上发送带有选项的产品
【发布时间】:2019-07-08 09:49:06
【问题描述】:
$productShopify = array(
    "body_html" => $product->description[(int)$id_lang],
    "created_at" => $date_now,
    "handle" => $product->name[(int)$id_lang],
    "id" => $product->id,
        "images"=>array(array("src"=>$ProducDATA['image']),
        //  array("src"=>$imageShopify[0]),
            array("src"=>$imageShopify[1])
        ),
    "options" => array("name" => $group_name[0],array("name" => $group_name[1])),
    "product_type" => $ProducDATA['Category_1'],
    "published_at" => $date_now,
    "published_scope" => "global",
    "tags" => $Tag,
    "template_suffix" => null,
    "title" => $product->name[(int)$id_lang],
    "variants" => array(
        array(
            "barcode" => $product->ean13,
            "grams" => $product->weight,
            "option1" => $attribute_name[0][1],
            "price" => $product->price,
            "sku" => $ProducDATA['manufacturer_reference'].'-1',
            "title" => $product->name[(int)$id_lang],
           // "id" => 808950810,
            "product_id" => $product->id,
            "inventory_quantity" => $product->id
        ),
        array(
            "barcode" => $product->ean13,
            "grams" => $product->weight,
            "option2" => $attribute_name[0][2],
            "price" => $product->price,
            "sku" => $ProducDATA['manufacturer_reference'].'-2',
            "title" => $product->name[(int)$id_lang],
           // "id" => 808950810,
            "product_id" => $product->id,
            "inventory_quantity" => $product->id
        ),
        array(
            "barcode" => $product->ean13,
            "grams" => $product->weight,
            "option1" => $attribute_name[1][1],
            "price" => $product->price,
            "sku" => $ProducDATA['manufacturer_reference'].'-3',
            "title" => $product->name[(int)$id_lang],
           // "id" => 808950810,
            "product_id" => $product->id,
            "inventory_quantity" => $product->id
        ),
        array(
            "barcode" => $product->ean13,
            "grams" => $product->weight,
            "option2" => $attribute_name[1][2],
            "price" => $product->price,
            "sku" => $ProducDATA['manufacturer_reference'].'-4',
            "title" => $product->name[(int)$id_lang],
           // "id" => 808950810,
            "product_id" => $product->id,
            "inventory_quantity" => $product->id
        )
    ),
    "vendor" => $ProducDATA['marque'],
);

我在shopify上找不到发送带有多个选项的产品的解决方案,语法错误

如果您有想法,我会尝试一切,但无法理解原理 我可以通过 1 个选项在 shopify 上发送产品,但不能 +

我可以通过只有 1 个选项在 shopify 上发送产品,但我不会从 Php 开始放纵

【问题讨论】:

    标签: php insert shopify


    【解决方案1】:

    您的 4 个变体中的每一个都应该有一个 option1 和 option2 的值。例如:

           array(
                "barcode" => $product->ean13,
                "grams" => $product->weight,
                "option1" => $attribute_name[0][1],
                "option2" => $attribute_name[0][2],
                "price" => $product->price,
                "sku" => $ProducDATA['manufacturer_reference'].'-1',
                "title" => $product->name[(int)$id_lang],
               // "id" => 808950810,
                "product_id" => $product->id,
                "inventory_quantity" => $product->id
            )
    

    此外,您应该检查 Shopify API 中的响应代码和响应正文。如果您的请求失败,它将包含有助于追踪错误的信息。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-09-05
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多