• WC OPC v1.7.1 has a change in woocommerce-one-page-checkout/templates/checkout/product-single.php that creates a PHP error with OceanWP.

    The newly added code is:

          <?php
            /**
             * Hook: woocommerce_after_single_product_summary.
             *
             * @hooked woocommerce_output_product_data_tabs - 10
             * @hooked woocommerce_upsell_display - 15
             * @hooked woocommerce_output_related_products - 20
             */
            do_action( 'woocommerce_after_single_product_summary' );
          ?>

    OceanWP has the following hook associated with this action:

          // Alter upsells display
          remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_upsell_display', 15 );
          if ( '0' != get_theme_mod( 'ocean_woocommerce_upsells_count', '3' ) ) {
            add_action( 'woocommerce_after_single_product_summary', array( $this, 'upsell_display' ), 15 );
          }
    

    but WC OPC disables the original hook:

          // remove upsells & related products
          remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_upsell_display', 15 );
    

    This leads to the following PHP error:

    [04-Dec-2019 08:02:38 UTC] [ERROR] lvl: 1 | msg:Uncaught Error: Call to a member function is_on_sale() on null in …/wp-content/plugins/woocommerce/templates/single-product/sale-flash.php:25
    Stack trace:
    #0 …/wp-content/plugins/woocommerce/includes/wc-core-functions.php(249): include()
    #1 …/wp-content/plugins/woocommerce/includes/wc-template-functions.php(1560): wc_get_template(‘single-product/…’)
    #2 …/wp-includes/class-wp-hook.php(288): woocommerce_show_product_sale_flash(”)
    #3 …/wp-includes/class-wp-hook.php(312): WP_Hook->apply_filters(”, Array)
    #4 …/wp-includes/plugin.php(478): WP_Hook->do_action(Array)
    #5 …/wp-content/plugins/woocommerce-one-page-checkout/templates/checkout/product-single.ph | file:…/wp-content/plugins/woocommerce/templates/single-product/sale-flash.php | ln:25

    A possible workaround if you don’t care about upsells is as follows:

    // Disable OceanWP upsells
    add_filter('theme_mod_ocean_woocommerce_upsells_count', 'my_theme_mod_ocean_woocommerce_upsells_count', 10 );
    function my_theme_mod_ocean_woocommerce_upsells_count() {
      return '0';
    }

    Please fix.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Conflict with Woocommerce One Page Checkout v1.7.1’ is closed to new replies.