如何避免在Woocomerce中上传图片,只需插入链接?

时间:2019-04-03 09:14:34

标签: java wordpress woocommerce

我正在使用Woocomerce的RestAPI,以编程方式上传我的产品。 这就是我作为JSON发送的内容:

{
    "create":[
        {
            "name":"PERLE ROSSO PR00111B",
            "regular_price":"22",
            "description":"PERLE ROSSO PR00111B",
            "sku":"8051827970412",
            "categories":[{"id":473}],
            "manage_stock":true,
            "stock_quantity":1,
            "shipping_class":"simple",
            "shipping_class_id":91,
            "images":[
                {
                    "src":"http://www.zanoletti.com/wp-content/uploads/products/loghi/99.png",
                    "position":1
                }
            ]
        },
        {
            "name":"Villeroy \u0026 Boch Artesano Orig. Tazza espresso c.p.2pezzi",
            "regular_price":"17,9",
            "description":"Villeroy \u0026 Boch Artesano Orig. Tazza espresso c.p.2pezzi",
            "sku":"4003686218598",
            "categories":[{"id":474}],
            "manage_stock":true,
            "stock_quantity":1,
            "shipping_class":"simple",
            "shipping_class_id":91
        },
        {
            "name":"CAP 7250 LENZUOLO SOPRA + FEDERE",
            "regular_price":"150",
            "description":"CAP 7250 LENZUOLO SOPRA + FEDERE",
            "sku":"8018579458636",
            "categories":[{"id":518}],
            "manage_stock":true,
            "stock_quantity":2,
            "shipping_class":"simple",
            "shipping_class_id":91,
            "images":[
                {
                    "src":"http://www.zanoletti.com/wp-content/uploads/products/loghi/69.png",
                    "position":1
                }
            ]
        }
    ]
}

我面临的问题是图像被复制,因为图像已经存在于wordpress中。我该如何解决这个问题? 如果存在图像my_image_for_1230_woocomerce.png,则具有链接,并且该图像可能用于其他产品,该图像始终上传到我的wordpress网站的wp-contant库中。我在哪里错了?

0 个答案:

没有答案