• Resolved billson888

    (@billson888)


    When CDN Mapping enabled (e.g.):
    CDN URL : https://cdn.gildan.sugarproject.com/

    The product description like this
    < img src=”/wp-content/uploads/2019/03/Logo_GildanPremiumCotton.png” width=”150″ />

    when we use wooCommerce API to list products wcapi.get(“products”).text and output like this
    < img src=\”\https://cdn.gildan.sugarproject.com/wp-content\ /uploads\/2019\/03\/Logo_GildanPremiumCotton.png\” width=\”150\” />

    wcapi.get(“products”).json() would occur error. I am not sure it s the litespeed CDN issue or wooCommerce API issue.
    If we disabled litespeed CDN, there is no any json error.

    • This topic was modified 4 years, 1 month ago by billson888.
    • This topic was modified 4 years, 1 month ago by billson888.
    • This topic was modified 4 years, 1 month ago by billson888.
    • This topic was modified 4 years, 1 month ago by billson888.

    The page I need help with: [log in to see the link]

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Support Hai Zheng?

    (@hailite)

    How did you use wcapi? Can you give a code snippet?

    Thread Starter billson888

    (@billson888)

    Simple code as the follows

        woo_config = configs[data_source]['woo']
        wcapi = API(
            url="{}".format(woo_config['url']),
            consumer_key=woo_config['consumer_key'],
            consumer_secret=woo_config['consumer_secret'],
            wp_api=True,
            version="wc/v3",
            timeout=300
        )
        # print(woo_config['url'])
        products = wcapi.get("products").json()
        print(products)

    If LS Cache CDN setting Disabled, it works. If CDN setting enabled, json error occur
    Traceback (most recent call last):
    File “C:/Users/user/Google Drive/Projects_py/woocommerce_py_2020/woo_multisite.py”, line 230, in <module>
    test_20200922()
    File “C:/Users/user/Google Drive/Projects_py/woocommerce_py_2020/woo_multisite.py”, line 205, in test_20200922
    products = wcapi.get(“products”).json()
    File “C:\Python\py368\lib\site-packages\requests\models.py”, line 898, in json
    return complexjson.loads(self.text, **kwargs)
    File “C:\Users\user\AppData\Local\Programs\Python\Python368\lib\json\__init__.py”, line 354, in loads
    return _default_decoder.decode(s)
    File “C:\Users\user\AppData\Local\Programs\Python\Python368\lib\json\decoder.py”, line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
    File “C:\Users\user\AppData\Local\Programs\Python\Python368\lib\json\decoder.py”, line 355, in raw_decode
    obj, end = self.scan_once(s, idx)
    json.decoder.JSONDecodeError: Invalid \escape: line 1 column 498 (char 497)

    Process finished with exit code 1

    Plugin Support Hai Zheng?

    (@hailite)

    I tested woo api, but can’t reproduce your issue. Can you please go to https://github.com/litespeedtech/lscache_wp/blob/master/src/cdn.cls.php#L226
    Add a line

    
    Debug2::debug( 'buffer ---------------'.$content);
    

    Then paste the log when you call that API? To reduce the content, you can just choose one product by

    
    wcapi.get("products/one_of_your_product_id")
    
    Thread Starter billson888

    (@billson888)

    Please find the output here

    11/04/20 01:48:59.995 [218.255.64.9:55773 2 fzL] e?’“ ------GET HTTP/1.1 (HTTPS)  /en/wp-json/wc/v3/products/4090
    11/04/20 01:48:59.995 [218.255.64.9:55773 2 fzL] Query String: 
    11/04/20 01:49:00.097 [218.255.64.9:55773 2 fzL] [Ctrl] X Cache_control -> no Cache ( logged in user )
    11/04/20 01:49:00.176 [35.241.67.106:52242 2 pF8] e?’“ ------POST HTTP/1.1 (HTTPS)  /en/wp-cron.php
    11/04/20 01:49:00.176 [35.241.67.106:52242 2 pF8] Query String: doing_wp_cron=1604454540.1159989833831787109375
    11/04/20 01:49:00.176 [35.241.67.106:52242 2 pF8] HTTP_REFERER: https://blanktee.hk/en/wp-cron.php?doing_wp_cron=1604454540.1159989833831787109375
    11/04/20 01:49:00.293 [35.241.67.106:52242 2 pF8] [Router] get_role: 
    11/04/20 01:49:00.342 [35.241.67.106:52242 2 pF8] [Ctrl] not cacheable before ctrl finalize
    11/04/20 01:49:00.342 [35.241.67.106:52242 2 pF8] [Router] get_role: 
    11/04/20 01:49:00.342 [35.241.67.106:52242 2 pF8] [Vary] role id: failed, guest
    11/04/20 01:49:00.342 [35.241.67.106:52242 2 pF8] [Router] get_role: 
    11/04/20 01:49:00.342 [35.241.67.106:52242 2 pF8] [Router] get_role: 
    11/04/20 01:49:00.342 [35.241.67.106:52242 2 pF8] e?’° X-LiteSpeed-Cache-Control: no-cache
    11/04/20 01:49:00.342 [35.241.67.106:52242 2 pF8] [Optm] bypass: Not frontend HTML type
    11/04/20 01:49:00.343 [35.241.67.106:52242 2 pF8] buffer ---------------
    11/04/20 01:49:00.343 [35.241.67.106:52242 2 pF8] End response
    --------------------------------------------------------------------------------
    
    11/04/20 01:49:00.365 [218.255.64.9:55773 2 fzL] [Router] get_role: administrator
    11/04/20 01:49:00.423 [218.255.64.9:55773 2 fzL] [Vary] Rest API init disabled vary change
    11/04/20 01:49:00.495 [218.255.64.9:55773 2 fzL] [Ctrl] not cacheable before ctrl finalize
    11/04/20 01:49:00.495 [218.255.64.9:55773 2 fzL] [Vary] can_change_vary bypassed due to litespeed_can_change_vary hook
    11/04/20 01:49:00.495 [218.255.64.9:55773 2 fzL] [Core] Silence Comment due to REST/AJAX
    11/04/20 01:49:00.495 [218.255.64.9:55773 2 fzL] e?’° X-LiteSpeed-Cache-Control: no-cache
    11/04/20 01:49:00.495 [218.255.64.9:55773 2 fzL] [Optm] bypass: Not frontend HTML type
    11/04/20 01:49:00.495 [218.255.64.9:55773 2 fzL] buffer ---------------{"id":4090,"name":"COMFORT COLORS 6030 6.1oz Adult Pigment Dye Pocket Tee (US Size)","slug":"comfort-colors-6030-6-1oz-adult-pigment-dye-pocket-tee-us-size","permalink":"https:\/\/blanktee.hk\/en\/product\/comfort-colors-6030-6-1oz-adult-pigment-dye-pocket-tee-us-size\/","date_created":"2020-07-07T06:33:13","date_created_gmt":"2020-07-07T06:33:13","date_modified":"2020-07-07T07:06:56","date_modified_gmt":"2020-07-07T07:06:56","type":"simple","status":"publish","featured":false,"catalog_visibility":"visible","description":"<p><img src=\"\/wp-content\/uploads\/2019\/03\/Logo_ComfortColors.png\" alt=\"Comfort Colors\" width=\"200\" \/><\/p>\n<h2>COMFORT COLORS 6030 6.1oz Adult Pigment Dye Pocket Tee (US Size)<\/h2>\n<p><strong>Discount per Quantity<\/strong><\/p>\n<div class=\"yith-wcpsc-product-table-responsive-container\">\n<table class=\"yith-wcpsc-product-table yith-wcpsc-product-table-elegant\">\n<thead>\n<tr>\n<th>QTY<\/th>\n<th>5 - 19<\/th>\n<th>20-49<\/th>\n<th>50+<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>\n<div class=\"yith-wcpsc-product-table-td-content\">Price<\/div>\n<\/td>\n<td>\n<div class=\"yith-wcpsc-product-table-td-content\">HK$65<\/div>\n<\/td>\n<td>\n<div class=\"yith-wcpsc-product-table-td-content\">HK$59<\/div>\n<\/td>\n<td>\n<div class=\"yith-wcpsc-product-table-td-content\">HK$59<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<table border=\"0\" width=\"240\">\n<tbody>\n<tr>\n<td><img src=\"\/wp-content\/uploads\/2019\/09\/6-1oz.png\" alt=\"6.1oz\" \/><\/td>\n<td><img src=\"\/wp-content\/uploads\/2019\/09\/210gsm.png\" alt=\"210gsm\" \/><\/td>\n<td><img src=\"\/wp-content\/uploads\/2019\/09\/m120008_csr-cotton-usa-hangtag-logo96x80.png\" alt=\"Cotton USA\" \/><\/td>\n<td><img src=\"\/wp-content\/uploads\/2019\/09\/m120004_csr-oeko-tex-logo156x80.png\" alt=\"OEKO-TEX Standard 100\" \/><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><img src=\"\/wp-content\/uploads\/2019\/10\/bright-salmon.jpg\" alt=\"Bright Salmon\" width=\"200\" \/><br \/>\n\u2022 100% Ring Spun Cotton<br \/>\n\u2022 210gsm (6.1oz)<br \/>\n\u2022 22\/1 yarn count<br \/>\n\u2022 Soft washed garment dyed fabric<br \/>\n\u2022 Twill taped neck and shoulders<br \/>\n\u2022 Twill label<br \/>\n\u2022 Joker label<br \/>\n\u2022 Double-needle collar, armhole, sleeve and bottom hems<br \/>\n\u2022 Tubular Construction T-Shirt<br \/>\n<a href=\"\/wp-content\/uploads\/2020\/06\/size-2020-eng-6030-01.jpg\" target=\"_Blank\" rel=\"noopener noreferrer\"><br \/>\n<img src=\"\/wp-content\/uploads\/2020\/06\/size-chart-eng.jpg\" \/><\/a><\/p>\n","short_description":"","sku":"603007416L","price":"39","regular_price":"69","sale_price":"39","date_on_sale_from":null,"date_on_sale_from_gmt":null,"date_on_sale_to":null,"date_on_sale_to_gmt":null,"price_html":"<del><span class=\"woocommerce-Price-amount amount\"><bdi><span class=\"woocommerce-Price-currencySymbol\">HK$<\/span>69.0<\/bdi><\/span><\/del> <ins><span class=\"woocommerce-Price-amount amount\"><bdi><span class=\"woocommerce-Price-currencySymbol\">HK$<\/span>39.0<\/bdi><\/span><\/ins>","on_sale":true,"purchasable":true,"total_sales":0,"virtual":false,"downloadable":false,"downloads":[],"download_limit":-1,"download_expiry":-1,"external_url":"","button_text":"","tax_status":"taxable","tax_class":"","manage_stock":true,"stock_quantity":49,"stock_status":"instock","backorders":"no","backorders_allowed":false,"backordered":false,"sold_individually":false,"weight":"","dimensions":{"length":"","width":"","height":""},"shipping_required":true,"shipping_taxable":true,"shipping_class":"","shipping_class_id":0,"reviews_allowed":true,"average_rating":"0.00","rating_count":0,"related_ids":[978,2186,2915,2143,2872],"upsell_ids":[],"cross_sell_ids":[],"parent_id":0,"purchase_note":"","categories":[{"id":51,"name":"Comfort Colors","slug":"comfort-colors"},{"id":67,"name":"Comfort Colors","slug":"comfort-colors-2"},{"id":63,"name":"Men","slug":"men"},{"id":74,"name":"Pocket Tee","slug":"pocket-tee"},{"id":24,"name":"T-Shirt","slug":"t-shirt"}],"tags":[{"id":83,"name":"100% Cotton","slug":"100-cotton"},{"id":198,"name":"COMFORT COLORS","slug":"comfort-colors"},{"id":204,"name":"Pigment-Dye","slug":"pigment-dye"},{"id":81,"name":"Pocket T","slug":"pocket-t"},{"id":186,"name":"US Size","slug":"us-size"}],"images":[{"id":4091,"date_created":"2020-07-07T06:32:55","date_created_gmt":"2020-07-07T06:32:55","date_modified":"2020-07-07T06:32:55","date_modified_gmt":"2020-07-07T06:32:55","src":"https:\/\/cdn.bt.sugarproject.com\/en\/wp-content\/uploads\/sites\/2\/2020\/07\/Comfort_Colors_6030_Bright_Salmon_Side.jpg","name":"Comfort_Colors_6030_Bright_Salmon_Side","alt":""}],"attributes":[],"default_attributes":[],"variations":[],"grouped_products":[],"menu_order":0,"meta_data":[{"id":73218,"key":"_wpml_word_count","value":"{\"total\":142,\"to_translate\":{\"zh-hant\":142}}"},{"id":73244,"key":"_yoast_wpseo_primary_product_cat","value":"51"},{"id":73245,"key":"_yoast_wpseo_primary_yith_product_brand","value":"28"},{"id":73246,"key":"ocean_sidebar","value":"0"},{"id":73247,"key":"ocean_second_sidebar","value":"0"},{"id":73248,"key":"ocean_disable_margins","value":"enable"},{"id":73249,"key":"ocean_display_top_bar","value":"default"},{"id":73250,"key":"ocean_display_header","value":"default"},{"id":73251,"key":"ocean_center_header_left_menu","value":"0"},{"id":73252,"key":"ocean_custom_header_template","value":"0"},{"id":73253,"key":"ocean_header_custom_menu","value":"0"},{"id":73254,"key":"ocean_menu_typo_font_family","value":"0"},{"id":73255,"key":"ocean_disable_title","value":"default"},{"id":73256,"key":"ocean_disable_heading","value":"default"},{"id":73257,"key":"ocean_disable_breadcrumbs","value":"default"},{"id":73258,"key":"ocean_display_footer_widgets","value":"default"},{"id":73259,"key":"ocean_display_footer_bottom","value":"default"},{"id":73260,"key":"ocean_custom_footer_template","value":"0"},{"id":73261,"key":"_wpml_media_duplicate","value":"1"},{"id":73262,"key":"_wpml_media_featured","value":"1"},{"id":73263,"key":"_yoast_wpseo_focuskw","value":"COMFORT COLORS 6030 6.1oz Adult Pigment Dye Pocket Tee (US Size)"},{"id":73264,"key":"_yoast_wpseo_metadesc","value":"Buy COMFORT COLORS 6030 6.1oz Adult Pigment Dye Pocket Tee (US Size) \u2022 100% Ring Spun Cotton\u2022 210gsm (6.1oz)\u2022 Soft washed garment dyed fabric"},{"id":73265,"key":"_yoast_wpseo_linkdex","value":"42"},{"id":73266,"key":"_yoast_wpseo_content_score","value":"60"}],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v15.2.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>COMFORT COLORS 6030 6.1oz Adult Pigment Dye Pocket Tee (US Size) - BlankTee.HK<\/title>\n<meta name=\"description\" content=\"Buy COMFORT COLORS 6030 6.1oz Adult Pigment Dye Pocket Tee (US Size) \u2022 100% Ring Spun Cotton\u2022 210gsm (6.1oz)\u2022 Soft washed garment dyed fabric\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/blanktee.hk\/en\/product\/comfort-colors-6030-6-1oz-adult-pigment-dye-pocket-tee-us-size\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"COMFORT COLORS 6030 6.1oz Adult Pigment Dye Pocket Tee (US Size) - BlankTee.HK\" \/>\n<meta property=\"og:description\" content=\"Buy COMFORT COLORS 6030 6.1oz Adult Pigment Dye Pocket Tee (US Size) \u2022 100% Ring Spun Cotton\u2022 210gsm (6.1oz)\u2022 Soft washed garment dyed fabric\" \/>\n<meta property=\"og:url\" content=\"https:\/\/blanktee.hk\/en\/product\/comfort-colors-6030-6-1oz-adult-pigment-dye-pocket-tee-us-size\/\" \/>\n<meta property=\"og:site_name\" content=\"BlankTee.HK\" \/>\n<meta property=\"article:modified_time\" content=\"2020-07-07T07:06:56+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cdn.bt.sugarproject.com\/en\/wp-content\/uploads\/sites\/2\/2020\/07\/Comfort_Colors_6030_Bright_Salmon_Side.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1000\" \/>\n\t<meta property=\"og:image:height\" content=\"1000\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\">\n\t<meta name=\"twitter:data1\" content=\"admin\">\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\">\n\t<meta name=\"twitter:data2\" content=\"0 minutes\">\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/blanktee.hk\/en\/#website\",\"url\":\"https:\/\/blanktee.hk\/en\/\",\"name\":\"BlankTee.HK\",\"description\":\"Your Online T-Shirt Store\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":\"https:\/\/blanktee.hk\/en\/?s={search_term_string}\",\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/blanktee.hk\/en\/product\/comfort-colors-6030-6-1oz-adult-pigment-dye-pocket-tee-us-size\/#primaryimage\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/cdn.bt.sugarproject.com\/en\/wp-content\/uploads\/sites\/2\/2020\/07\/Comfort_Colors_6030_Bright_Salmon_Side.jpg\",\"width\":1000,\"height\":1000},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/blanktee.hk\/en\/product\/comfort-colors-6030-6-1oz-adult-pigment-dye-pocket-tee-us-size\/#webpage\",\"url\":\"https:\/\/blanktee.hk\/en\/product\/comfort-colors-6030-6-1oz-adult-pigment-dye-pocket-tee-us-size\/\",\"name\":\"COMFORT COLORS 6030 6.1oz Adult Pigment Dye Pocket Tee (US Size) - BlankTee.HK\",\"isPartOf\":{\"@id\":\"https:\/\/blanktee.hk\/en\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/blanktee.hk\/en\/product\/comfort-colors-6030-6-1oz-adult-pigment-dye-pocket-tee-us-size\/#primaryimage\"},\"datePublished\":\"2020-07-07T06:33:13+00:00\",\"dateModified\":\"2020-07-07T07:06:56+00:00\",\"description\":\"Buy COMFORT COLORS 6030 6.1oz Adult Pigment Dye Pocket Tee (US Size) \\u2022 100% Ring Spun Cotton\\u2022 210gsm (6.1oz)\\u2022 Soft washed garment dyed fabric\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/blanktee.hk\/en\/product\/comfort-colors-6030-6-1oz-adult-pigment-dye-pocket-tee-us-size\/\"]}]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","_links":{"self":[{"href":"https:\/\/blanktee.hk\/en\/wp-json\/wc\/v3\/products\/4090"}],"collection":[{"href":"https:\/\/blanktee.hk\/en\/wp-json\/wc\/v3\/products"}]}}
    11/04/20 01:49:00.495 [218.255.64.9:55773 2 fzL] CDN _finalize
    11/04/20 01:49:00.496 [218.255.64.9:55773 2 fzL] End response
    --------------------------------------------------------------------------------
    
    
    Plugin Support Hai Zheng?

    (@hailite)

    Can you paste the log before enabled CDN for comparison? The REST buffer is json, thus the img tag is escaped. After that, LSCWP will not be able to find the normal HTML img tag. Then it won’t be replaced to CDN path.

    Thread Starter billson888

    (@billson888)

    Hi Hai,

    Here is the output when CDN disabled. Thank you!

    11/05/20 00:44:48.419 [218.255.64.9:63835 2 dnR] ?? ------GET HTTP/1.1 (HTTPS)  /en/wp-json/wc/v3/products/4090
    11/05/20 00:44:48.419 [218.255.64.9:63835 2 dnR] Query String: 
    11/05/20 00:44:48.511 [218.255.64.9:63835 2 dnR] [Ctrl] X Cache_control -> no Cache ( logged in user )
    11/05/20 00:44:48.583 [35.241.67.106:51030 2 l2S] ?? ------POST HTTP/1.1 (HTTPS)  /en/wp-cron.php
    11/05/20 00:44:48.583 [35.241.67.106:51030 2 l2S] Query String: doing_wp_cron=1604537088.5252599716186523437500
    11/05/20 00:44:48.583 [35.241.67.106:51030 2 l2S] HTTP_REFERER: https://blanktee.hk/en/wp-cron.php?doing_wp_cron=1604537088.5252599716186523437500
    11/05/20 00:44:48.698 [35.241.67.106:51030 2 l2S] [Router] get_role: 
    11/05/20 00:44:48.742 [35.241.67.106:51030 2 l2S] [Img_Optm] cron_pull running
    11/05/20 00:44:48.742 [35.241.67.106:51030 2 l2S] [Img_Optm] ? no need pull [tag] 
    11/05/20 00:44:48.758 [35.241.67.106:51030 2 l2S] [Ctrl] not cacheable before ctrl finalize
    11/05/20 00:44:48.758 [35.241.67.106:51030 2 l2S] [Router] get_role: 
    11/05/20 00:44:48.758 [35.241.67.106:51030 2 l2S] [Vary] role id: failed, guest
    11/05/20 00:44:48.758 [35.241.67.106:51030 2 l2S] [Router] get_role: 
    11/05/20 00:44:48.758 [35.241.67.106:51030 2 l2S] [Router] get_role: 
    11/05/20 00:44:48.758 [35.241.67.106:51030 2 l2S] ?? X-LiteSpeed-Cache-Control: no-cache
    11/05/20 00:44:48.758 [35.241.67.106:51030 2 l2S] [Optm] bypass: Not frontend HTML type
    11/05/20 00:44:48.758 [35.241.67.106:51030 2 l2S] buffer ---------------
    11/05/20 00:44:48.758 [35.241.67.106:51030 2 l2S] End response
    --------------------------------------------------------------------------------
    
    11/05/20 00:44:48.779 [218.255.64.9:63835 2 dnR] [Router] get_role: administrator
    11/05/20 00:44:48.834 [218.255.64.9:63835 2 dnR] [Vary] Rest API init disabled vary change
    11/05/20 00:44:48.885 [218.255.64.9:63835 2 dnR] [Ctrl] not cacheable before ctrl finalize
    11/05/20 00:44:48.885 [218.255.64.9:63835 2 dnR] [Vary] can_change_vary bypassed due to litespeed_can_change_vary hook
    11/05/20 00:44:48.886 [218.255.64.9:63835 2 dnR] [Core] Silence Comment due to REST/AJAX
    11/05/20 00:44:48.886 [218.255.64.9:63835 2 dnR] ?? X-LiteSpeed-Cache-Control: no-cache
    11/05/20 00:44:48.886 [218.255.64.9:63835 2 dnR] [Optm] bypass: Not frontend HTML type
    11/05/20 00:44:48.886 [218.255.64.9:63835 2 dnR] buffer ---------------{"id":4090,"name":"COMFORT COLORS 6030 6.1oz Adult Pigment Dye Pocket Tee (US Size)","slug":"comfort-colors-6030-6-1oz-adult-pigment-dye-pocket-tee-us-size","permalink":"https:\/\/blanktee.hk\/en\/product\/comfort-colors-6030-6-1oz-adult-pigment-dye-pocket-tee-us-size\/","date_created":"2020-07-07T06:33:13","date_created_gmt":"2020-07-07T06:33:13","date_modified":"2020-07-07T07:06:56","date_modified_gmt":"2020-07-07T07:06:56","type":"simple","status":"publish","featured":false,"catalog_visibility":"visible","description":"<p><img src=\"\/wp-content\/uploads\/2019\/03\/Logo_ComfortColors.png\" alt=\"Comfort Colors\" width=\"200\" \/><\/p>\n<h2>COMFORT COLORS 6030 6.1oz Adult Pigment Dye Pocket Tee (US Size)<\/h2>\n<p><strong>Discount per Quantity<\/strong><\/p>\n<div class=\"yith-wcpsc-product-table-responsive-container\">\n<table class=\"yith-wcpsc-product-table yith-wcpsc-product-table-elegant\">\n<thead>\n<tr>\n<th>QTY<\/th>\n<th>5 - 19<\/th>\n<th>20-49<\/th>\n<th>50+<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>\n<div class=\"yith-wcpsc-product-table-td-content\">Price<\/div>\n<\/td>\n<td>\n<div class=\"yith-wcpsc-product-table-td-content\">HK$65<\/div>\n<\/td>\n<td>\n<div class=\"yith-wcpsc-product-table-td-content\">HK$59<\/div>\n<\/td>\n<td>\n<div class=\"yith-wcpsc-product-table-td-content\">HK$59<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<table border=\"0\" width=\"240\">\n<tbody>\n<tr>\n<td><img src=\"\/wp-content\/uploads\/2019\/09\/6-1oz.png\" alt=\"6.1oz\" \/><\/td>\n<td><img src=\"\/wp-content\/uploads\/2019\/09\/210gsm.png\" alt=\"210gsm\" \/><\/td>\n<td><img src=\"\/wp-content\/uploads\/2019\/09\/m120008_csr-cotton-usa-hangtag-logo96x80.png\" alt=\"Cotton USA\" \/><\/td>\n<td><img src=\"\/wp-content\/uploads\/2019\/09\/m120004_csr-oeko-tex-logo156x80.png\" alt=\"OEKO-TEX Standard 100\" \/><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><img src=\"\/wp-content\/uploads\/2019\/10\/bright-salmon.jpg\" alt=\"Bright Salmon\" width=\"200\" \/><br \/>\n\u2022 100% Ring Spun Cotton<br \/>\n\u2022 210gsm (6.1oz)<br \/>\n\u2022 22\/1 yarn count<br \/>\n\u2022 Soft washed garment dyed fabric<br \/>\n\u2022 Twill taped neck and shoulders<br \/>\n\u2022 Twill label<br \/>\n\u2022 Joker label<br \/>\n\u2022 Double-needle collar, armhole, sleeve and bottom hems<br \/>\n\u2022 Tubular Construction T-Shirt<br \/>\n<a href=\"\/wp-content\/uploads\/2020\/06\/size-2020-eng-6030-01.jpg\" target=\"_Blank\" rel=\"noopener noreferrer\"><br \/>\n<img src=\"\/wp-content\/uploads\/2020\/06\/size-chart-eng.jpg\" \/><\/a><\/p>\n","short_description":"","sku":"603007416L","price":"39","regular_price":"69","sale_price":"39","date_on_sale_from":null,"date_on_sale_from_gmt":null,"date_on_sale_to":null,"date_on_sale_to_gmt":null,"price_html":"<del><span class=\"woocommerce-Price-amount amount\"><bdi><span class=\"woocommerce-Price-currencySymbol\">HK$<\/span>69.0<\/bdi><\/span><\/del> <ins><span class=\"woocommerce-Price-amount amount\"><bdi><span class=\"woocommerce-Price-currencySymbol\">HK$<\/span>39.0<\/bdi><\/span><\/ins>","on_sale":true,"purchasable":true,"total_sales":0,"virtual":false,"downloadable":false,"downloads":[],"download_limit":-1,"download_expiry":-1,"external_url":"","button_text":"","tax_status":"taxable","tax_class":"","manage_stock":true,"stock_quantity":49,"stock_status":"instock","backorders":"no","backorders_allowed":false,"backordered":false,"sold_individually":false,"weight":"","dimensions":{"length":"","width":"","height":""},"shipping_required":true,"shipping_taxable":true,"shipping_class":"","shipping_class_id":0,"reviews_allowed":true,"average_rating":"0.00","rating_count":0,"related_ids":[597,43,2143,2705,1188],"upsell_ids":[],"cross_sell_ids":[],"parent_id":0,"purchase_note":"","categories":[{"id":51,"name":"Comfort Colors","slug":"comfort-colors"},{"id":67,"name":"Comfort Colors","slug":"comfort-colors-2"},{"id":63,"name":"Men","slug":"men"},{"id":74,"name":"Pocket Tee","slug":"pocket-tee"},{"id":24,"name":"T-Shirt","slug":"t-shirt"}],"tags":[{"id":83,"name":"100% Cotton","slug":"100-cotton"},{"id":198,"name":"COMFORT COLORS","slug":"comfort-colors"},{"id":204,"name":"Pigment-Dye","slug":"pigment-dye"},{"id":81,"name":"Pocket T","slug":"pocket-t"},{"id":186,"name":"US Size","slug":"us-size"}],"images":[{"id":4091,"date_created":"2020-07-07T06:32:55","date_created_gmt":"2020-07-07T06:32:55","date_modified":"2020-07-07T06:32:55","date_modified_gmt":"2020-07-07T06:32:55","src":"https:\/\/blanktee.hk\/en\/wp-content\/uploads\/sites\/2\/2020\/07\/Comfort_Colors_6030_Bright_Salmon_Side.jpg","name":"Comfort_Colors_6030_Bright_Salmon_Side","alt":""}],"attributes":[],"default_attributes":[],"variations":[],"grouped_products":[],"menu_order":0,"meta_data":[{"id":73218,"key":"_wpml_word_count","value":"{\"total\":142,\"to_translate\":{\"zh-hant\":142}}"},{"id":73244,"key":"_yoast_wpseo_primary_product_cat","value":"51"},{"id":73245,"key":"_yoast_wpseo_primary_yith_product_brand","value":"28"},{"id":73246,"key":"ocean_sidebar","value":"0"},{"id":73247,"key":"ocean_second_sidebar","value":"0"},{"id":73248,"key":"ocean_disable_margins","value":"enable"},{"id":73249,"key":"ocean_display_top_bar","value":"default"},{"id":73250,"key":"ocean_display_header","value":"default"},{"id":73251,"key":"ocean_center_header_left_menu","value":"0"},{"id":73252,"key":"ocean_custom_header_template","value":"0"},{"id":73253,"key":"ocean_header_custom_menu","value":"0"},{"id":73254,"key":"ocean_menu_typo_font_family","value":"0"},{"id":73255,"key":"ocean_disable_title","value":"default"},{"id":73256,"key":"ocean_disable_heading","value":"default"},{"id":73257,"key":"ocean_disable_breadcrumbs","value":"default"},{"id":73258,"key":"ocean_display_footer_widgets","value":"default"},{"id":73259,"key":"ocean_display_footer_bottom","value":"default"},{"id":73260,"key":"ocean_custom_footer_template","value":"0"},{"id":73261,"key":"_wpml_media_duplicate","value":"1"},{"id":73262,"key":"_wpml_media_featured","value":"1"},{"id":73263,"key":"_yoast_wpseo_focuskw","value":"COMFORT COLORS 6030 6.1oz Adult Pigment Dye Pocket Tee (US Size)"},{"id":73264,"key":"_yoast_wpseo_metadesc","value":"Buy COMFORT COLORS 6030 6.1oz Adult Pigment Dye Pocket Tee (US Size) \u2022 100% Ring Spun Cotton\u2022 210gsm (6.1oz)\u2022 Soft washed garment dyed fabric"},{"id":73265,"key":"_yoast_wpseo_linkdex","value":"42"},{"id":73266,"key":"_yoast_wpseo_content_score","value":"60"}],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v15.2.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>COMFORT COLORS 6030 6.1oz Adult Pigment Dye Pocket Tee (US Size) - BlankTee.HK<\/title>\n<meta name=\"description\" content=\"Buy COMFORT COLORS 6030 6.1oz Adult Pigment Dye Pocket Tee (US Size) \u2022 100% Ring Spun Cotton\u2022 210gsm (6.1oz)\u2022 Soft washed garment dyed fabric\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/blanktee.hk\/en\/product\/comfort-colors-6030-6-1oz-adult-pigment-dye-pocket-tee-us-size\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"COMFORT COLORS 6030 6.1oz Adult Pigment Dye Pocket Tee (US Size) - BlankTee.HK\" \/>\n<meta property=\"og:description\" content=\"Buy COMFORT COLORS 6030 6.1oz Adult Pigment Dye Pocket Tee (US Size) \u2022 100% Ring Spun Cotton\u2022 210gsm (6.1oz)\u2022 Soft washed garment dyed fabric\" \/>\n<meta property=\"og:url\" content=\"https:\/\/blanktee.hk\/en\/product\/comfort-colors-6030-6-1oz-adult-pigment-dye-pocket-tee-us-size\/\" \/>\n<meta property=\"og:site_name\" content=\"BlankTee.HK\" \/>\n<meta property=\"article:modified_time\" content=\"2020-07-07T07:06:56+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/blanktee.hk\/en\/wp-content\/uploads\/sites\/2\/2020\/07\/Comfort_Colors_6030_Bright_Salmon_Side.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1000\" \/>\n\t<meta property=\"og:image:height\" content=\"1000\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\">\n\t<meta name=\"twitter:data1\" content=\"admin\">\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\">\n\t<meta name=\"twitter:data2\" content=\"0 minutes\">\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/blanktee.hk\/en\/#website\",\"url\":\"https:\/\/blanktee.hk\/en\/\",\"name\":\"BlankTee.HK\",\"description\":\"Your Online T-Shirt Store\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":\"https:\/\/blanktee.hk\/en\/?s={search_term_string}\",\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/blanktee.hk\/en\/product\/comfort-colors-6030-6-1oz-adult-pigment-dye-pocket-tee-us-size\/#primaryimage\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/blanktee.hk\/en\/wp-content\/uploads\/sites\/2\/2020\/07\/Comfort_Colors_6030_Bright_Salmon_Side.jpg\",\"width\":1000,\"height\":1000},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/blanktee.hk\/en\/product\/comfort-colors-6030-6-1oz-adult-pigment-dye-pocket-tee-us-size\/#webpage\",\"url\":\"https:\/\/blanktee.hk\/en\/product\/comfort-colors-6030-6-1oz-adult-pigment-dye-pocket-tee-us-size\/\",\"name\":\"COMFORT COLORS 6030 6.1oz Adult Pigment Dye Pocket Tee (US Size) - BlankTee.HK\",\"isPartOf\":{\"@id\":\"https:\/\/blanktee.hk\/en\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/blanktee.hk\/en\/product\/comfort-colors-6030-6-1oz-adult-pigment-dye-pocket-tee-us-size\/#primaryimage\"},\"datePublished\":\"2020-07-07T06:33:13+00:00\",\"dateModified\":\"2020-07-07T07:06:56+00:00\",\"description\":\"Buy COMFORT COLORS 6030 6.1oz Adult Pigment Dye Pocket Tee (US Size) \\u2022 100% Ring Spun Cotton\\u2022 210gsm (6.1oz)\\u2022 Soft washed garment dyed fabric\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/blanktee.hk\/en\/product\/comfort-colors-6030-6-1oz-adult-pigment-dye-pocket-tee-us-size\/\"]}]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","_links":{"self":[{"href":"https:\/\/blanktee.hk\/en\/wp-json\/wc\/v3\/products\/4090"}],"collection":[{"href":"https:\/\/blanktee.hk\/en\/wp-json\/wc\/v3\/products"}]}}
    11/05/20 00:44:48.886 [218.255.64.9:63835 2 dnR] End response
    --------------------------------------------------------------------------------
    
    Plugin Support Hai Zheng?

    (@hailite)

    For the

    
    "images":[{"id":4091,"date_created":"2020-07-07T06:32:55","date_created_gmt":"2020-07-07T06:32:55","date_modified":"2020-07-07T06:32:55","date_modified_gmt":"2020-07-07T06:32:55","src":"https:\/\/cdn.bt.sugarproject.com\/en\/wp-content\/uploads\/sites\/2\/2020\/07\/Comfort_Colors_6030_Bright_Salmon_Side.jpg"
    

    part, before using CDN, it is

    
    ,"images":[{"id":4091,"date_created":"2020-07-07T06:32:55","date_created_gmt":"2020-07-07T06:32:55","date_modified":"2020-07-07T06:32:55","date_modified_gmt":"2020-07-07T06:32:55","src":"https:\/\/blanktee.hk\/en\/wp-content\/uploads\/sites\/2\/2020\/07\/Comfort_Colors_6030_Bright_Salmon_Side.jpg"
    

    which is still escaped. I didn’t follow what your issue is.

    Thread Starter billson888

    (@billson888)

    Hi Hai,

    The product image seem ok, but the json issue is in product description part
    when I print the json output
    print(wcapi.get(“products/4090”).text)
    When CDN enabled

    
     "description": "<p><img   src=\"\https://blanktee.hk/wp-content\ /uploads\/2019\/03\/Logo_ComfortColors.png\" alt=\"Comfort Colors\" width=\"200\" \/><\/p>\n<h2>COMFORT COLORS 6030 6.1oz Adult Pigment Dye Pocket Tee (US Size)<\/h2>\n<p><strong>Discount per Quantity<\/strong><\/p>\n<div class=\"yith-wcpsc-product-table-responsive-container\">\n<table class=\"yith-wcpsc-product-table yith-wcpsc-product-table-elegant\">\n<thead>\n<tr>\n<th>QTY<\/th>\n<th>5 - 19<\/th>\n<th>20-49<\/th>\n<th>50+<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>\n<div class=\"yith-wcpsc-product-table-td-content\">Price<\/div>\n<\/td>\n<td>\n<div class=\"yith-wcpsc-product-table-td-content\">HK$65<\/div>\n<\/td>\n<td>\n<div class=\"yith-wcpsc-product-table-td-content\">HK$59<\/div>\n<\/td>\n<td>\n<div class=\"yith-wcpsc-product-table-td-content\">HK$59<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<table border=\"0\" width=\"240\">\n<tbody>\n<tr>\n<td><img   src=\"\https://blanktee.hk/wp-content\ /uploads\/2019\/09\/6-1oz.png\" alt=\"6.1oz\" \/><\/td>\n<td><img   src=\"\https://blanktee.hk/wp-content\ /uploads\/2019\/09\/210gsm.png\" alt=\"210gsm\" \/><\/td>\n<td><img   src=\"\https://blanktee.hk/wp-content\ /uploads\/2019\/09\/m120008_csr-cotton-usa-hangtag-logo96x80.png\" alt=\"Cotton USA\" \/><\/td>\n<td><img   src=\"\https://blanktee.hk/wp-content\ /uploads\/2019\/09\/m120004_csr-oeko-tex-logo156x80.png\" alt=\"OEKO-TEX Standard 100\" \/><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><img   src=\"\https://blanktee.hk/wp-content\ /uploads\/2019\/10\/bright-salmon.jpg\" alt=\"Bright Salmon\" width=\"200\" \/><br \/>\n\u2022 100% Ring Spun Cotton<br \/>\n\u2022 210gsm (6.1oz)<br \/>\n\u2022 22\/1 yarn count<br \/>\n\u2022 Soft washed garment dyed fabric<br \/>\n\u2022 Twill taped neck and shoulders<br \/>\n\u2022 Twill label<br \/>\n\u2022 Joker label<br \/>\n\u2022 Double-needle collar, armhole, sleeve and bottom hems<br \/>\n\u2022 Tubular Construction T-Shirt<br \/>\n<a href=\"\/wp-content\/uploads\/2020\/06\/size-2020-eng-6030-01.jpg\" target=\"_Blank\" rel=\"noopener noreferrer\"><br \/>\n<img   src=\"\https://blanktee.hk/wp-content\ /uploads\/2020\/06\/size-chart-eng.jpg\" \/><\/a><\/p>\n",
     

    For CDN disabled and the product description is

    
     "description": "<p><img src=\"\/wp-content\/uploads\/2019\/03\/Logo_ComfortColors.png\" alt=\"Comfort Colors\" width=\"200\" \/><\/p>\n<h2>COMFORT COLORS 6030 6.1oz Adult Pigment Dye Pocket Tee (US Size)<\/h2>\n<p><strong>Discount per Quantity<\/strong><\/p>\n<div class=\"yith-wcpsc-product-table-responsive-container\">\n<table class=\"yith-wcpsc-product-table yith-wcpsc-product-table-elegant\">\n<thead>\n<tr>\n<th>QTY<\/th>\n<th>5 - 19<\/th>\n<th>20-49<\/th>\n<th>50+<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>\n<div class=\"yith-wcpsc-product-table-td-content\">Price<\/div>\n<\/td>\n<td>\n<div class=\"yith-wcpsc-product-table-td-content\">HK$65<\/div>\n<\/td>\n<td>\n<div class=\"yith-wcpsc-product-table-td-content\">HK$59<\/div>\n<\/td>\n<td>\n<div class=\"yith-wcpsc-product-table-td-content\">HK$59<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<table border=\"0\" width=\"240\">\n<tbody>\n<tr>\n<td><img src=\"\/wp-content\/uploads\/2019\/09\/6-1oz.png\" alt=\"6.1oz\" \/><\/td>\n<td><img src=\"\/wp-content\/uploads\/2019\/09\/210gsm.png\" alt=\"210gsm\" \/><\/td>\n<td><img src=\"\/wp-content\/uploads\/2019\/09\/m120008_csr-cotton-usa-hangtag-logo96x80.png\" alt=\"Cotton USA\" \/><\/td>\n<td><img src=\"\/wp-content\/uploads\/2019\/09\/m120004_csr-oeko-tex-logo156x80.png\" alt=\"OEKO-TEX Standard 100\" \/><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><img src=\"\/wp-content\/uploads\/2019\/10\/bright-salmon.jpg\" alt=\"Bright Salmon\" width=\"200\" \/><br \/>\n\u2022 100% Ring Spun Cotton<br \/>\n\u2022 210gsm (6.1oz)<br \/>\n\u2022 22\/1 yarn count<br \/>\n\u2022 Soft washed garment dyed fabric<br \/>\n\u2022 Twill taped neck and shoulders<br \/>\n\u2022 Twill label<br \/>\n\u2022 Joker label<br \/>\n\u2022 Double-needle collar, armhole, sleeve and bottom hems<br \/>\n\u2022 Tubular Construction T-Shirt<br \/>\n<a href=\"\/wp-content\/uploads\/2020\/06\/size-2020-eng-6030-01.jpg\" target=\"_Blank\" rel=\"noopener noreferrer\"><br \/>\n<img src=\"\/wp-content\/uploads\/2020\/06\/size-chart-eng.jpg\" \/><\/a><\/p>\n",
     
    Thread Starter billson888

    (@billson888)

    Hi Hai,

    I found a update. This error would occur at WordPress Multisite setup. I have tested under single WordPress. It is fine.

    Any idea?

    • This reply was modified 4 years ago by billson888.
    Thread Starter billson888

    (@billson888)

    OK, I found exact issue now. The problem would occur in Product Long Description and Short Description with img tag link or href link is relative path
    e.g. img tag like this with LS Cache enabled, then use Python to query the product list. JSON output error

    
    <img src="/wp-content/uploads/2019/10/bright-salmon.jpg" alt="Bright Salmon" width="200"/>
    

    If I change the img tag to absolute path, No error occur.

    
    <img src="https://blanktee.hk/wp-content/uploads/2019/10/bright-salmon.jpg" alt="Bright Salmon" width="200"/>
    
    • This reply was modified 4 years ago by billson888.
Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘wooCommerce API to get product listing error’ is closed to new replies.