Support » Plugin: WooCommerce » Woocommerce 3.0.4 Checkout Invalid Product with Variable Produts

  • 
    ### WordPress Environment ###
    
    Home URL: http://justtherightbook.juliabalfourbeta.com
    Site URL: http://justtherightbook.juliabalfourbeta.com
    WC Version: 3.0.4
    Log Directory Writable: ✔
    WP Version: 4.7.4
    WP Multisite: –
    WP Memory Limit: 256 MB
    WP Debug Mode: –
    WP Cron: ✔
    Language: en_US
    
    ### Server Environment ###
    
    Server Info: Apache
    PHP Version: ❌ 5.4.13 - We recommend a minimum PHP version of 5.6. See: How to update your PHP version
    PHP Post Max Size: 30 MB
    PHP Time Limit: 300
    PHP Max Input Vars: 10000
    cURL Version: 7.19.7
    NSS/3.21 Basic ECC
    
    SUHOSIN Installed: –
    MySQL Version: ❌ 5.5.30 - We recommend a minimum MySQL version of 5.6. See: WordPress requirements
    Max Upload Size: 30 MB
    Default Timezone is UTC: ✔
    fsockopen/cURL: ✔
    SoapClient: ✔
    DOMDocument: ✔
    GZip: ✔
    Multibyte String: ✔
    Remote Post: ✔
    Remote Get: ✔
    
    ### Database ###
    
    WC Database Version: 3.0.4
    WC Database Prefix: wp_
    woocommerce_sessions: ✔
    woocommerce_api_keys: ✔
    woocommerce_attribute_taxonomies: ✔
    woocommerce_downloadable_product_permissions: ✔
    woocommerce_order_items: ✔
    woocommerce_order_itemmeta: ✔
    woocommerce_tax_rates: ✔
    woocommerce_tax_rate_locations: ✔
    woocommerce_shipping_zones: ✔
    woocommerce_shipping_zone_locations: ✔
    woocommerce_shipping_zone_methods: ✔
    woocommerce_payment_tokens: ✔
    woocommerce_payment_tokenmeta: ✔
    MaxMind GeoIP Database: ✔
    
    ### Security ###
    
    Secure connection (HTTPS): ❌Your store is not using HTTPS. Learn more about HTTPS and SSL Certificates.
    Hide errors from visitors: ✔
    
    ### Active Plugins (12) ###
    
    Gravity Forms: by rocketgenius – 2.2.1.2
    Advanced Custom Fields PRO: by Elliot Condon – 5.4.8
    Duplicate Page: by mndpsingh287 – 2.2
    Gravity Forms MailChimp Add-On: by rocketgenius – 4.2
    Simple 301 Redirects: by Scott Nellé – 1.07
    WooCommerce Customer/Order/Coupon CSV Import Suite: by WooThemes / SkyVerge – 3.1.1 – 3.3.1 is available
    WooCommerce Stripe Gateway: by WooCommerce – 3.1.7
    WooCommerce Subscriptions: by Prospress Inc. – 2.2.5
    WooCommerce: by Automattic – 3.0.4
    WooCommerce Helper: by WooCommerce – 1.7.2 – Network enabled
    Wordfence Security: by Wordfence – 6.3.6
    WP Crontrol: by John Blackbourn & contributors – 1.5
    
    ### Settings ###
    
    API Enabled: ✔
    Force SSL: –
    Currency: USD ($)
    Currency Position: left
    Thousand Separator: ,
    Decimal Separator: .
    Number of Decimals: 2
    Taxonomies: Product Types: external (external)
    grouped (grouped)
    simple (simple)
    subscription (subscription)
    variable (variable)
    variable subscription (variable-subscription)
    
    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: #4 - /shop/
    Cart: #3060 - /cart/
    Checkout: #3061 - /checkout/
    My account: #3062 - /my-account/
    
    ### Theme ###
    
    Name: Just The Right Book
    2.0
    
    Version: 2.0.0
    Author URL: http://www.juliabalfour.com
    Child Theme: ❌ – If you're modifying WooCommerce on a parent theme you didn't build personally
    then we recommend using a child theme. See: How to create a child theme
    
    WooCommerce Support: ✔
    
    ### Templates ###
    
    Overrides: JTRB/woocommerce/cart/cart.php
    JTRB/woocommerce/checkout/form-billing.php
    JTRB/woocommerce/checkout/form-checkout.php
    JTRB/woocommerce/checkout/form-shipping.php
    JTRB/woocommerce/checkout/thankyou.php
    JTRB/woocommerce/content-single-product.php
    JTRB/woocommerce/emails/admin-cancelled-order.php
    JTRB/woocommerce/emails/admin-new-order.php
    JTRB/woocommerce/emails/customer-completed-order.php
    JTRB/woocommerce/emails/customer-invoice.php
    JTRB/woocommerce/emails/customer-new-account.php
    JTRB/woocommerce/emails/customer-note.php
    JTRB/woocommerce/emails/customer-processing-order.php
    JTRB/woocommerce/emails/customer-refunded-order.php
    JTRB/woocommerce/emails/customer-reset-password.php
    JTRB/woocommerce/emails/email-addresses.php
    JTRB/woocommerce/emails/email-customer-details.php
    JTRB/woocommerce/emails/email-footer.php
    JTRB/woocommerce/emails/email-header.php
    JTRB/woocommerce/emails/email-order-details.php
    JTRB/woocommerce/emails/email-order-items.php
    JTRB/woocommerce/emails/email-styles.php
    JTRB/woocommerce/emails/plain/admin-cancelled-order.php
    JTRB/woocommerce/emails/plain/admin-new-order.php
    JTRB/woocommerce/emails/plain/customer-completed-order.php
    JTRB/woocommerce/emails/plain/customer-invoice.php
    JTRB/woocommerce/emails/plain/customer-new-account.php
    JTRB/woocommerce/emails/plain/customer-note.php
    JTRB/woocommerce/emails/plain/customer-processing-order.php
    JTRB/woocommerce/emails/plain/customer-refunded-order.php
    JTRB/woocommerce/emails/plain/customer-reset-password.php
    JTRB/woocommerce/emails/plain/email-addresses.php
    JTRB/woocommerce/emails/plain/email-order-items.php
    JTRB/woocommerce/myaccount/dashboard.php
    JTRB/woocommerce/myaccount/form-login.php
    JTRB/woocommerce/myaccount/my-account.php
    JTRB/woocommerce/myaccount/orders.php
    JTRB/woocommerce/single-product/add-to-cart/variable.php
    
    ### subscriptions ###
    
    WCS_DEBUG: ✔ No
    Subscriptions Mode: ✔ Live
    

    When updating our staging site to the new woocommerce, i’ve found an issue when trying to checkout with a variable product, it always gives me an invalid product error.

    Looking deeper into the source code i’ve found that the error message is being created because the product_type is ‘product variation’ when running the read function.

    		if ( ! $product->get_id() || ! ( $post_object = get_post( $product->get_id() ) ) || 'product' !== $post_object->post_type ) {
    			throw new Exception( __( 'Invalid product.', 'woocommerce' ) );
    		}
    

    Any help or guidance on how to fix this issue would be very much appreciated.

Viewing 10 replies - 1 through 10 (of 10 total)
  • When i turn on debug i get this error message instead

    
    SyntaxError: Unexpected token < in JSON at position 0
    
    Plugin Author Mike Jolley

    (@mikejolley)

    Can you trace what is doing the read? ‘product_variation’ should be read fine, if the code doing the read uses wc_get_product method. Sounds like something is loading classes directly.

    It seems to be related to whenever I try to add order item meta or update the meta values.

    Tracing it back further it read gets called after WC_Subscriptions_Synchroniser::mayber_add_meta_for_new_line and WC_Subscriptions_Synchroniser::is_product_synced finds that the product/subscription in question is not an object. Then wc_get_product is called right after.

    Plugin Author Mike Jolley

    (@mikejolley)

    If turning off WC_Subscriptions_Synchroniser stops it breaking, it will help us know if thats the cause – then the developer can be notified.

    Hey Mike I really appreciate the help. I’m not entirely sure how to turn off WC_Subscriptions_Synchroniser but when I delete our add/update_order_item_meta functions it will checkout with no issue.

    Plugin Author Mike Jolley

    (@mikejolley)

    > delete our add/update_order_item_meta

    is that custom code you can share?

    I’ll have to get back to you on that.

    I can give you the hooks/actions we are using.

    Actions:
    woocommerce_new_order_item
    woocommerce_checkout_update_order_meta

    Functions:
    wc_add_order_item_meta
    wc_update_order_item_meta

    We also create a new WC_Product_Variable in the woocommerce_checkout_update_order_meta but I don’t think that’s the issue.

    hello, i’m having the same issue after upgrading to version 3.0.5. any help?

    I think i’ve figured out the issue or at least from my code.

    When hooking into woocommerce_checkout_update_order_meta and woocommerce_payment_successful_result actions you can’t call a new variable like so.

    
    			// $variation = new WC_Product_Variable( $meta['_variation_id'][0] );
    
Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Woocommerce 3.0.4 Checkout Invalid Product with Variable Produts’ is closed to new replies.