Support » Plugin: WooCommerce » CDN variable product images replaced with local urls

  • Resolved sixsixninenine

    (@sixsixninenine)


    When viewing a single product, main and gallery images load from the CDN (Amazon S3 bucket). When the add-to-cart-variation.min.js script has loaded, the CDN URLs are replaced with the local files.

    The site is currently on a private staging server, but the issue can be replicated by using WooCommerce, Storefront and W3 total cache (no caching, just the CDN feature) and viewing a variable product.

    Every other call to image attachments throughout the site are replaced with the correct URLs.

    I cannot say if this issue occurs with all CDN offloading plugins or just W3, so I have raised a ticket in this forum.

    Thanks.

Viewing 7 replies - 1 through 7 (of 7 total)
  • I’d like to reopen this as, although I found a fix, it seems that this is only an issue in WooCommerce. My other sites have no issue with the CDN, W3 Total Cache and image source set URLs.

    Plugin Support Jesse Pearson

    (@jessepearson)

    Automattic Happiness Engineer

    @sixsixninenine Can you go to WooCommerce > Status and copy/paste your System Status Report here for us?

    Plugin Support Jesse Pearson

    (@jessepearson)

    Automattic Happiness Engineer

    
    ### WordPress Environment ###
    
    Home URL: https://www.xxxxxxxxxx.co.uk
    Site URL: https://www.xxxxxxxxxx.co.uk
    WC Version: 3.4.2
    Log Directory Writable: ❌ To allow logging
    make /home/xxxxxxxxxx/public_html/wp-content/uploads/wc-logs/ writable or define a custom WC_LOG_DIR.
    
    WP Version: 4.9.6
    WP Multisite: –
    WP Memory Limit: 256 MB
    WP Debug Mode: –
    WP Cron: ✔
    Language: en_US
    External object cache: –
    
    ### Server Environment ###
    
    Server Info: Apache/2.4.23 (Unix) OpenSSL/1.0.1e-fips mod_bwlimited/1.4 mod_fcgid/2.3.9
    PHP Version: 7.0.30 - We recommend using PHP version 7.2 or above for greater performance and security. How to update your PHP version
    PHP Post Max Size: 8 MB
    PHP Time Limit: 30
    PHP Max Input Vars: 1000
    cURL Version: 7.54.0
    OpenSSL/1.0.2k
    
    SUHOSIN Installed: –
    MySQL Version: 5.6.39-log
    Max Upload Size: 2 MB
    Default Timezone is UTC: ✔
    fsockopen/cURL: ✔
    SoapClient: ✔
    DOMDocument: ✔
    GZip: ✔
    Multibyte String: ✔
    Remote Post: ✔
    Remote Get: ✔
    
    ### Database ###
    
    WC Database Version: 3.4.2
    WC Database Prefix: wp_
    MaxMind GeoIP Database: ✔
    Total Database Size: 41.16MB
    Database Data Size: 25.33MB
    Database Index Size: 15.83MB
    wp_woocommerce_sessions: Data: 8.02MB + Index: 0.06MB
    wp_woocommerce_api_keys: Data: 0.02MB + Index: 0.03MB
    wp_woocommerce_attribute_taxonomies: Data: 0.02MB + Index: 0.02MB
    wp_woocommerce_downloadable_product_permissions: Data: 0.02MB + Index: 0.05MB
    wp_woocommerce_order_items: Data: 0.48MB + Index: 0.16MB
    wp_woocommerce_order_itemmeta: Data: 1.52MB + Index: 3.03MB
    wp_woocommerce_tax_rates: Data: 0.02MB + Index: 0.06MB
    wp_woocommerce_tax_rate_locations: Data: 0.02MB + Index: 0.03MB
    wp_woocommerce_shipping_zones: Data: 0.02MB + Index: 0.00MB
    wp_woocommerce_shipping_zone_locations: Data: 0.02MB + Index: 0.05MB
    wp_woocommerce_shipping_zone_methods: Data: 0.02MB + Index: 0.00MB
    wp_woocommerce_payment_tokens: Data: 0.02MB + Index: 0.02MB
    wp_woocommerce_payment_tokenmeta: Data: 0.02MB + Index: 0.03MB
    wp_woocommerce_log: Data: 0.02MB + Index: 0.02MB
    wp_commentmeta: Data: 0.02MB + Index: 0.03MB
    wp_comments: Data: 0.02MB + Index: 0.09MB
    wp_ewwwio_images: Data: 1.52MB + Index: 1.67MB
    wp_failed_jobs: Data: 0.02MB + Index: 0.00MB
    wp_hugeit_slider_slide: Data: 0.02MB + Index: 0.00MB
    wp_hugeit_slider_slider: Data: 0.02MB + Index: 0.00MB
    wp_links: Data: 0.02MB + Index: 0.02MB
    wp_mailchimp_carts: Data: 0.02MB + Index: 0.00MB
    wp_masterslider_options: Data: 0.02MB + Index: 0.02MB
    wp_masterslider_sliders: Data: 0.02MB + Index: 0.02MB
    wp_options: Data: 2.31MB + Index: 0.27MB
    wp_postmeta: Data: 5.52MB + Index: 5.03MB
    wp_posts: Data: 1.52MB + Index: 0.66MB
    wp_queue: Data: 0.02MB + Index: 0.00MB
    wp_termmeta: Data: 0.06MB + Index: 0.03MB
    wp_terms: Data: 0.02MB + Index: 0.03MB
    wp_term_relationships: Data: 0.11MB + Index: 0.08MB
    wp_term_taxonomy: Data: 0.02MB + Index: 0.03MB
    wp_usermeta: Data: 3.52MB + Index: 4.03MB
    wp_users: Data: 0.19MB + Index: 0.17MB
    wp_w3tc_cdn_pathmap: Data: 0.02MB + Index: 0.02MB
    wp_w3tc_cdn_queue: Data: 0.02MB + Index: 0.02MB
    wp_wcpdf_invoice_number: Data: 0.00MB + Index: 0.00MB
    wp_wc_download_log: Data: 0.02MB + Index: 0.03MB
    wp_wc_webhooks: Data: 0.02MB + Index: 0.02MB
    wp_yikes_easy_mc_forms: Data: 0.02MB + Index: 0.00MB
    wp_yoast_seo_links: Data: 0.00MB + Index: 0.00MB
    wp_yoast_seo_meta: Data: 0.00MB + Index: 0.00MB
    
    ### Post Type Counts ###
    
    acf: 1
    attachment: 951
    customize_changeset: 2
    jcd_promo_box: 1
    mc4wp-form: 2
    nav_menu_item: 10
    page: 21
    post: 3
    product: 675
    product_variation: 344
    revision: 71
    shop_coupon: 29
    shop_order: 1118
    shop_order_refund: 1
    wccpf: 1
    wpcf7_contact_form: 1
    
    ### Security ###
    
    Secure connection (HTTPS): ✔
    Hide errors from visitors: ✔
    
    ### Active Plugins (22) ###
    
    a3 Lazy Load: by a3rev Software – 1.8.9
    Advanced Custom Fields: by Elliot Condon – 4.4.12
    Cart2Cart: Password Migration: by MagneticOne – 1.1
    Contact Form 7 Honeypot: by Nocean – 1.13
    Contact Form 7: by Takayuki Miyoshi – 5.0.2
    Cookie Notice: by dFactory – 1.2.44
    xxxxxxxxxx WooCommerce: by sixsixninenine – 1.0 – Not tested with the active version of WooCommerce
    Master Slider: by averta – 3.5.1
    Simple Multibuy Discount: by sixsixnineinine – 1.0 – Not tested with the active version of WooCommerce
    W3 Total Cache: by Frederick Townes – 0.9.7
    WC Fields Factory: by Saravana Kumar K – 2.0.8 – Not tested with the active version of WooCommerce
    WooCommerce PayPal Express Checkout Gateway: by WooCommerce – 1.5.6
    WooCommerce Stripe Gateway: by WooCommerce – 4.1.7
    WooCommerce Google Analytics Integration: by WooCommerce – 1.4.4 – Not tested with the active version of WooCommerce
    Woocommerce osCommerce Import Branch For Zencart: by David Barnes – 1.2.1 – Not tested with the active version of WooCommerce
    WooCommerce PDF Invoices & Packing Slips: by Ewout Fernhout – 2.1.9
    WooCommerce Wholesale Lead Capture: by Rymera Web Co – 1.7.5
    WooCommerce Wholesale Order Form: by Rymera Web Co – 1.8.6
    WooCommerce Wholesale Prices Premium: by Rymera Web Co – 1.16.6
    WooCommerce Wholesale Prices: by Rymera Web Co – 1.6.5
    WooCommerce: by Automattic – 3.4.2 – 3.4.3 is available
    Yoast SEO: by Team Yoast – 7.6.1
    
    ### Settings ###
    
    API Enabled: ✔
    Force SSL: –
    Currency: GBP (£)
    Currency Position: left
    Thousand Separator: ,
    Decimal Separator: .
    Number of Decimals: 2
    Taxonomies: Product Types: external (external)
    grouped (grouped)
    simple (simple)
    variable (variable)
    
    Taxonomies: Product Visibility: exclude-from-catalog (exclude-from-catalog)
    exclude-from-search (exclude-from-search)
    featured (featured)
    outofstock (outofstock)
    rated-1 (rated-1)
    rated-2 (rated-2)
    rated-3 (rated-3)
    rated-4 (rated-4)
    rated-5 (rated-5)
    
    ### WC Pages ###
    
    Shop base: #8 - /shop/
    Cart: #9 - /cart/
    Checkout: #10 - /checkout/
    My account: #11 - /my-account/
    Terms and conditions: #403 - /terms-and-conditions/
    
    ### Theme ###
    
    Name: xxxxxxxxxx
    Version: 1.0
    Author URL: http://woocommerce.com
    Child Theme: ✔
    Parent Theme Name: Storefront
    Parent Theme Version: 2.3.2
    Parent Theme Author URL: https://woocommerce.com/
    WooCommerce Support: ✔
    
    ### Templates ###
    
    Overrides: xxxxxxxxxx/woocommerce/global/quantity-input.php
    xxxxxxxxxx/woocommerce/single-product/add-to-cart/variation.php
    
    

    Thanks Jesse, the issues and pull requests you links to seem to relate to image generation.

    The images that are referenced after selecting a product variation all exist (on the CDN server), but they reference the local images rather than the ones on the CDN. I only noticed as I do not store the images locally so they appear as missing images, but only because the URL points to the wrong server.

    Plugin Support Jesse Pearson

    (@jessepearson)

    Automattic Happiness Engineer

    @sixsixninenine It looks like this is probably an issue with W3 Total Cache over WooCommerce. I dove into the code, and this is where the images are pulled for variations:
    https://github.com/woocommerce/woocommerce/blob/3.4.3/includes/wc-product-functions.php#L684-L740

    As can be seen, the standard WordPress core functions are used to grab the image sources. I would have to believe that’s where W3 would filter the output in order to serve the CDN urls for the images.

    With that being said, I do see what you are referring to and was able to replicate it, which led me to look into the code to find where the images were coming from.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘CDN variable product images replaced with local urls’ is closed to new replies.