Title: Plugin creating PHP error
Last modified: July 2, 2025

---

# Plugin creating PHP error

 *  Resolved [webzang](https://wordpress.org/support/users/webzang/)
 * (@webzang)
 * [11 months, 1 week ago](https://wordpress.org/support/topic/plugin-creating-php-error/)
 * The plugin is causing a conflict and showing code on the product page as follows:
 * `Uncaught Error: Call to a member function get_meta() on string in /home/ravesfro/
   public_html/wp-content/plugins/yith-pre-order-for-woocommerce/includes/class-
   yith-pre-order-product.php on line 69 Call stack: YITH_Pre_Order_Product::get_pre_order_status()
   wp-content/themes/raves/woocommerce/single-product/add-to-cart/variable.php:28
   include('/home/ravesfro/publi...to-cart/variable.php') wp-content/plugins/woocommerce/
   includes/wc-core-functions.php:346 wc_get_template() wp-content/plugins/woocommerce/
   includes/wc-template-functions.php:1962 woocommerce_variable_add_to_cart() wp-
   includes/class-wp-hook.php:324 WP_Hook::apply_filters() wp-includes/class-wp-
   hook.php:348 WP_Hook::do_action() wp-includes/plugin.php:517 do_action() wp-content/
   plugins/woocommerce/includes/wc-template-functions.php:1904 woocommerce_template_single_add_to_cart()
   wp-includes/class-wp-hook.php:324 WP_Hook::apply_filters() wp-includes/class-
   wp-hook.php:348 WP_Hook::do_action() wp-includes/plugin.php:517 do_action() wp-
   content/themes/raves/woocommerce/content-single-product.php:80 require('/home/
   ravesfro/publi...t-single-product.php') wp-includes/template.php:812 load_template()
   wp-content/plugins/woocommerce/includes/wc-core-functions.php:285 wc_get_template_part()
   wp-content/themes/raves/woocommerce/single-product.php:29 include('/home/ravesfro/
   publi...e/single-product.php') wp-includes/template-loader.php:106 require_once('/
   home/ravesfro/publi.../template-loader.php') wp-blog-header.php:19 require('/
   home/ravesfro/public_html/wp-blog-header.php') index.php:17`
 * we have tried switching to a default theme, deactivating other plugins and we
   have had to deactivate it as it looks so bad on the site.
 * Is this a known issue? Is there any patch before I switch to a different plugin?
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fplugin-creating-php-error%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 6 replies - 1 through 6 (of 6 total)

 *  Plugin Support [Carlos M](https://wordpress.org/support/users/cjmora/)
 * (@cjmora)
 * [11 months, 1 week ago](https://wordpress.org/support/topic/plugin-creating-php-error/#post-18537685)
 * Hi [@webzang](https://wordpress.org/support/users/webzang/),
   The problem comes
   from this file from your “raves” theme:`_wp-content/themes/raves/woocommerce/
   single-product/add-to-cart/variable.php_`
 * Maybe the problem isn’t related to Pre-Order but a bad practice on this template
   file within your theme.
   Is it possible to paste here in your next reply the content
   of the `variable.php` file, at least the lines surrounding line 28? Just to understand
   better what is being called there.
 *  Thread Starter [webzang](https://wordpress.org/support/users/webzang/)
 * (@webzang)
 * [11 months, 1 week ago](https://wordpress.org/support/topic/plugin-creating-php-error/#post-18537686)
 * Hi
 * Thanks so much for your quick relpy. here is the first 37 lines from that theme
   file:
 * /**
    - Variable product add to cart
      *
    - This template can be overridden by copying it to yourtheme/woocommerce/single-
      product/add-to-cart/variable.php.
      *
    - HOWEVER, on occasion WooCommerce will need to update template files and you
    - (the theme developer) will need to copy the new files to your theme to
    - maintain compatibility. We try to do this as little as possible, but it does
    - happen. When this occurs the version of the template file will be bumped and
    - the readme will list any important changes.
      *
    - @see https://docs.woocommerce.com/document/template-structure/
    - @package WooCommerce/Templates
    - @version 3.5.5
      */
 * defined( 'ABSPATH' ) || exit;
 * global $product;
 * $attribute_keys = array_keys( $attributes );
 * foreach( $available_variations as $i => $variation ) {
   $id = $variation['variation_id'];
   if ( class_exists( 'YITH_Pre_Order_Product' ) ){$pre_order = new YITH_Pre_Order_Product(
   $id );if ( $pre_order->get_pre_order_status() == 'yes') {$available_variations[
   $i]['availability_html'] = '
 * Pre-order';
   }}}
 * $variations_json = wp_json_encode( $available_variations );
   $variations_attr 
   = function_exists( 'wc_esc_json' ) ? wc_esc_json( $variations_json ) : _wp_specialchars(
   $variations_json, ENT_QUOTES, 'UTF-8', true );
 * do_action( 'woocommerce_before_add_to_cart_form' );
 *  Plugin Support [Carlos M](https://wordpress.org/support/users/cjmora/)
 * (@cjmora)
 * [11 months, 1 week ago](https://wordpress.org/support/topic/plugin-creating-php-error/#post-18537803)
 * Hi [@webzang](https://wordpress.org/support/users/webzang/),
   Indeed, the problem
   is not from the Pre-Order plugin, but a custom code added to that template that
   uses functions of the Pre-Order plugin incorrectly.To fix the issue, replace 
   this part:
 *     ```wp-block-code
       foreach( $available_variations as $i => $variation ) {    $id = $variation['variation_id'];    if ( class_exists( 'YITH_Pre_Order_Product' ) ){        $pre_order = new YITH_Pre_Order_Product( $id );        if ( $pre_order->get_pre_order_status() == 'yes') {            $available_variations[$i]['availability_html'] = 'Pre-order';        }    }}
       ```
   
 * with this:
 *     ```wp-block-code
       if ( class_exists( 'YITH_Pre_Order_Utils' ) ) {    foreach( $available_variations as $i => $variation ) {        if ( $variation instanceof WC_Product && YITH_Pre_Order_Utils::is_pre_order_active( $variation ) ) {            $available_variations[$i]['availability_html'] = 'Pre-order';        }    }}
       ```
   
 *  Thread Starter [webzang](https://wordpress.org/support/users/webzang/)
 * (@webzang)
 * [11 months, 1 week ago](https://wordpress.org/support/topic/plugin-creating-php-error/#post-18538183)
 * This worked really well great. is there a way to remove the gap between the “
   expected” date and variation descriptions? See [https://ravesfromthegrave.com/shop/beneath-strawberry-moons/](https://ravesfromthegrave.com/shop/beneath-strawberry-moons/)
 * ![](https://i0.wp.com/ravesfromthegrave.com/wp-content/uploads/2025/07/Screenshot-
   2025-07-02-at-16.37.25.jpg?ssl=1)
 *  Plugin Support [Carlos M](https://wordpress.org/support/users/cjmora/)
 * (@cjmora)
 * [11 months, 1 week ago](https://wordpress.org/support/topic/plugin-creating-php-error/#post-18538192)
 * Hi [@webzang](https://wordpress.org/support/users/webzang/),
   A CSS code like 
   this should remove the gap:
 *     ```wp-block-code
       .ywpo_availability_date.pre_order_single-no-auto-format {    margin-bottom: 0px !important;}
       ```
   
 *  Thread Starter [webzang](https://wordpress.org/support/users/webzang/)
 * (@webzang)
 * [11 months, 1 week ago](https://wordpress.org/support/topic/plugin-creating-php-error/#post-18538275)
 * Thanks so much this fixed it! Much appreciated.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Plugin creating PHP error’ is closed to new replies.

 * ![](https://ps.w.org/yith-pre-order-for-woocommerce/assets/icon.svg?rev=3307139)
 * [YITH Pre-Order for WooCommerce](https://wordpress.org/plugins/yith-pre-order-for-woocommerce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/yith-pre-order-for-woocommerce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/yith-pre-order-for-woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/yith-pre-order-for-woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/yith-pre-order-for-woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/yith-pre-order-for-woocommerce/reviews/)

## Tags

 * [php-error](https://wordpress.org/support/topic-tag/php-error/)

 * 6 replies
 * 2 participants
 * Last reply from: [webzang](https://wordpress.org/support/users/webzang/)
 * Last activity: [11 months, 1 week ago](https://wordpress.org/support/topic/plugin-creating-php-error/#post-18538275)
 * Status: resolved