• After updating to any higher php from 7.4, The below Error appears in product page in wp-admin section:

    I have added below code in function.php as per this topic.

    If i comment out the line 63 below code, the error disappears, if i uncomment the codec the error re-appears and i have to downgrade the php to 7.4.

    63. //$price_with_shipping = $price + $shipping_cost; 

    Error Appears on Admin page in Product page:

    Fatal error: Uncaught Error: Unsupported operand types: string + int
    in /home/bigswip1/public_html/wp-content/themes/woodmart/functions.php on line 63
    
    Call stack:
    
    wc_add_shipping_cost_to_product_price()
    wp-includes/class-wp-hook.php:324
    WP_Hook::apply_filters()
    wp-includes/plugin.php:205
    apply_filters()
    wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-data.php:884
    WC_Data::get_prop()
    wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-product.php:270
    WC_Product::get_price()
    wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-product.php:1876
    WC_Product::get_price_html()
    wp-content/plugins/woocommerce/includes/admin/list-tables/class-wc-admin-list-table-products.php:217
    WC_Admin_List_Table_Products::render_price_column()
    wp-content/plugins/woocommerce/includes/admin/list-tables/abstract-class-wc-admin-list-table.php:261
    WC_Admin_List_Table::render_columns()
    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-admin/includes/class-wp-posts-list-table.php:1398
    WP_Posts_List_Table::column_default()
    wp-admin/includes/class-wp-list-table.php:1796
    WP_List_Table::single_row_columns()
    wp-admin/includes/class-wp-posts-list-table.php:1432
    WP_Posts_List_Table::single_row()
    wp-admin/includes/class-wp-posts-list-table.php:834
    WP_Posts_List_Table::_display_rows()
    wp-admin/includes/class-wp-posts-list-table.php:810
    WP_Posts_List_Table::display_rows()
    wp-admin/includes/class-wp-list-table.php:1706
    WP_List_Table::display_rows_or_placeholder()
    wp-admin/includes/class-wp-list-table.php:1633
    WP_List_Table::display()
    wp-admin/edit.php:503
    Query Monitor
    

    Kindly help to use latest php version… Thanks

Viewing 7 replies - 1 through 7 (of 7 total)
  • Stef

    (@serafinnyc)

    Can you send us a systems report?

    Go to WooCommerce > Status > Get Systems Report and pasting that here inside using a Code Block.

    Thread Starter venkeyaccent

    (@venkeyaccent)

    Thanks for quick support reply.

    please find status report below:

    `
    ### WordPress Environment ###
    
    WordPress address (URL): https://bigswipe.in
    Site address (URL): https://bigswipe.in
    WC Version: 8.8.3
    REST API Version: ? 8.8.3
    Action Scheduler Version: ? 3.7.4
    Log Directory Writable: ?
    WP Version: 6.5.3
    WP Multisite: –
    WP Memory Limit: 512 MB
    WP Debug Mode: –
    WP Cron: ?
    Language: en_US
    External object cache: ?
    
    ### Server Environment ###
    
    Server Info: LiteSpeed
    PHP Version: 8.0.30
    PHP Post Max Size: 512 MB
    PHP Time Limit: 60
    PHP Max Input Vars: 10000
    cURL Version: 7.87.0
    OpenSSL/1.1.1w
    
    SUHOSIN Installed: –
    MySQL Version: 10.6.17-MariaDB
    Max Upload Size: 512 MB
    Default Timezone is UTC: ?
    fsockopen/cURL: ?
    SoapClient: ?
    DOMDocument: ?
    GZip: ?
    Multibyte String: ?
    Remote Post: ?
    Remote Get: ?
    
    ### Database ###
    
    WC Database Version: 8.8.3
    WC Database Prefix: wptf_
    Total Database Size: 31.28MB
    Database Data Size: 26.39MB
    Database Index Size: 4.89MB
    wptf_woocommerce_sessions: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wptf_woocommerce_api_keys: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wptf_woocommerce_attribute_taxonomies: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wptf_woocommerce_downloadable_product_permissions: Data: 0.02MB + Index: 0.06MB + Engine InnoDB
    wptf_woocommerce_order_items: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wptf_woocommerce_order_itemmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wptf_woocommerce_tax_rates: Data: 0.02MB + Index: 0.06MB + Engine InnoDB
    wptf_woocommerce_tax_rate_locations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wptf_woocommerce_shipping_zones: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wptf_woocommerce_shipping_zone_locations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wptf_woocommerce_shipping_zone_methods: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wptf_woocommerce_payment_tokens: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wptf_woocommerce_payment_tokenmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wptf_woocommerce_log: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wptf_actionscheduler_actions: Data: 0.34MB + Index: 0.45MB + Engine InnoDB
    wptf_actionscheduler_claims: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wptf_actionscheduler_groups: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wptf_actionscheduler_logs: Data: 0.20MB + Index: 0.17MB + Engine InnoDB
    wptf_commentmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wptf_comments: Data: 0.05MB + Index: 0.09MB + Engine InnoDB
    wptf_e_events: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wptf_e_notes: Data: 0.02MB + Index: 0.17MB + Engine InnoDB
    wptf_e_notes_users_relations: Data: 0.02MB + Index: 0.05MB + Engine InnoDB
    wptf_e_submissions: Data: 0.02MB + Index: 0.27MB + Engine InnoDB
    wptf_e_submissions_actions_log: Data: 0.02MB + Index: 0.11MB + Engine InnoDB
    wptf_e_submissions_values: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wptf_gla_attribute_mapping_rules: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wptf_gla_budget_recommendations: Data: 0.19MB + Index: 0.14MB + Engine InnoDB
    wptf_gla_merchant_issues: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wptf_gla_shipping_rates: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wptf_gla_shipping_times: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wptf_imagify_files: Data: 0.14MB + Index: 0.13MB + Engine InnoDB
    wptf_imagify_folders: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wptf_links: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wptf_litespeed_avatar: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wptf_litespeed_img_optming: Data: 0.11MB + Index: 0.16MB + Engine InnoDB
    wptf_litespeed_url: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wptf_litespeed_url_file: Data: 0.02MB + Index: 0.08MB + Engine InnoDB
    wptf_options: Data: 5.06MB + Index: 0.13MB + Engine InnoDB
    wptf_postmeta: Data: 4.02MB + Index: 0.52MB + Engine InnoDB
    wptf_posts: Data: 5.05MB + Index: 0.13MB + Engine InnoDB
    wptf_post_smtp_logmeta: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wptf_post_smtp_logs: Data: 8.02MB + Index: 0.00MB + Engine InnoDB
    wptf_termmeta: Data: 0.03MB + Index: 0.03MB + Engine InnoDB
    wptf_terms: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wptf_term_relationships: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wptf_term_taxonomy: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wptf_usermeta: Data: 1.52MB + Index: 0.48MB + Engine InnoDB
    wptf_users: Data: 0.08MB + Index: 0.05MB + Engine InnoDB
    wptf_wcfm_fbc_chat_rows: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wptf_wcfm_fbc_chat_sessions: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wptf_wcfm_fbc_chat_visitors: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wptf_wcfm_fbc_offline_messages: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wptf_wcfm_membership_subscription: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wptf_wcfm_store_locations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wptf_wcfm_store_locations_meta: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wptf_wc_admin_notes: Data: 0.06MB + Index: 0.00MB + Engine InnoDB
    wptf_wc_admin_note_actions: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wptf_wc_category_lookup: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wptf_wc_customer_lookup: Data: 0.05MB + Index: 0.03MB + Engine InnoDB
    wptf_wc_download_log: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wptf_wc_orders: Data: 0.02MB + Index: 0.11MB + Engine InnoDB
    wptf_wc_orders_meta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wptf_wc_order_addresses: Data: 0.02MB + Index: 0.06MB + Engine InnoDB
    wptf_wc_order_coupon_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wptf_wc_order_operational_data: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wptf_wc_order_product_lookup: Data: 0.02MB + Index: 0.06MB + Engine InnoDB
    wptf_wc_order_stats: Data: 0.02MB + Index: 0.05MB + Engine InnoDB
    wptf_wc_order_tax_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wptf_wc_product_attributes_lookup: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wptf_wc_product_download_directories: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wptf_wc_product_meta_lookup: Data: 0.02MB + Index: 0.09MB + Engine InnoDB
    wptf_wc_rate_limits: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wptf_wc_reserved_stock: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wptf_wc_tax_rate_classes: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wptf_wc_webhooks: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wptf_woodmart_wishlists: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wptf_woodmart_wishlist_products: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wptf_woo_wallet_transactions: Data: 0.11MB + Index: 0.02MB + Engine InnoDB
    wptf_woo_wallet_transaction_meta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wptf_wpforms_logs: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wptf_wpforms_payments: Data: 0.02MB + Index: 0.14MB + Engine InnoDB
    wptf_wpforms_payment_meta: Data: 0.02MB + Index: 0.05MB + Engine InnoDB
    wptf_wpforms_tasks_meta: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    
    ### Post Type Counts ###
    
    attachment: 321
    cms_block: 27
    elementor_library: 1
    nav_menu_item: 100
    page: 58
    portfolio: 9
    post: 10
    product: 3
    revision: 36
    wcfm_memberships: 2
    woodmart_sidebar: 1
    woodmart_size_guide: 1
    woodmart_slide: 3
    wp_font_family: 12
    wp_navigation: 1
    wpforms: 2
    
    ### Security ###
    
    Secure connection (HTTPS): ?
    Hide errors from visitors: ?
    
    ### Active Plugins (17) ###
    
    Query Monitor: by John Blackbourn – 3.16.2
    atec Cache Info: by Chris Ahrweiler – 1.4.2
    Elementor: by Elementor.com – 3.21.5
    GTranslate: by Translate AI Multilingual Solutions – 3.0.6
    Hide Categories Or Products On Shop Page: by wordpplugin – 1.0.6
    Imagify: by Imagify – Optimize Images & Convert WebP & Avif – 2.2.2
    LiteSpeed Cache: by LiteSpeed Technologies – 6.2.0.1
    Post SMTP: by Post SMTP – 2.9.1
    PRO Elements: by PROElements.org – 3.21.2
    Redis Object Cache: by Till Krüss – 2.5.2
    SQLite Object Cache: by Oliver Jones – 1.3.8
    1 Razorpay: Signup for FREE PG: by Team Razorpay – 4.6.4
    TeraWallet: by StandaloneTech – 1.5.3
    WooCommerce: by Automattic – 8.8.3
    Woodmart Core: by  – 1.0.43
    WordPress Importer: by wordpressdotorg – 0.8.2
    WPForms Lite: by WPForms – 1.8.8.3
    
    ### Inactive Plugins (6) ###
    
    WCFM - WooCommerce Frontend Manager: by WC Lovers – 6.7.10
    WCFM - WooCommerce Frontend Manager - Ultimate: by WC Lovers – 6.7.5
    WCFM - WooCommerce Multivendor Marketplace: by WC Lovers – 3.6.8
    WCFM - WooCommerce Multivendor Marketplace - Elementor: by WC Lovers – 3.0.3
    WCFM - WooCommerce Multivendor Marketplace - REST API: by WC Lovers – 1.6.2
    WCFM - WooCommerce Multivendor Membership: by WC Lovers – 2.11.3
    
    ### Dropin Plugins () ###
    
    db.php: Query Monitor Database Class (Drop-in)
    maintenance.php: maintenance.php
    object-cache.php: Redis Object Cache Drop-In
    
    ### Settings ###
    
    API Enabled: –
    Force SSL: –
    Currency: INR (?)
    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)
    
    Connected to WooCommerce.com: –
    Enforce Approved Product Download Directories: ?
    HPOS feature screen enabled: ?
    HPOS feature enabled: ?
    Order datastore: Automattic\WooCommerce\Internal\DataStores\Orders\OrdersTableDataStore
    HPOS data sync enabled: ?
    
    ### Logging ###
    
    Enabled: ?
    Handler: Automattic\WooCommerce\Internal\Admin\Logging\LogHandlerFileV2
    Retention period: 30 days
    Level threshold: –
    Log directory size: 145 KB
    
    ### WC Pages ###
    
    Shop base: #47 - /shop/
    Cart: #13 - /cart/
    Checkout: #14 - /checkout/
    My account: #15 - /my-account/
    Terms and conditions: ? Page not set
    
    ### Theme ###
    
    Name: Woodmart Child
    Version: 1.0.0
    Author URL: https://xtemos.com
    Child Theme: ?
    Parent Theme Name: Woodmart
    Parent Theme Version: 7.5.1
    Parent Theme Author URL: https://themeforest.net/user/xtemos
    WooCommerce Support: ?
    
    ### Templates ###
    
    Overrides: woodmart/woocommerce/archive-product.php
    woodmart/woocommerce/cart/cart-item-data.php
    woodmart/woocommerce/cart/cart.php
    woodmart/woocommerce/cart/cross-sells.php
    woodmart/woocommerce/cart/mini-cart.php
    woodmart/woocommerce/checkout/form-checkout.php
    woodmart/woocommerce/checkout/thankyou.php
    woodmart/woocommerce/content-product-cat.php
    woodmart/woocommerce/content-product.php
    woodmart/woocommerce/content-single-product.php
    woodmart/woocommerce/content-widget-product.php
    woodmart/woocommerce/global/breadcrumb.php
    woodmart/woocommerce/global/form-login.php
    woodmart/woocommerce/global/quantity-input.php
    woodmart/woocommerce/loop/add-to-cart.php
    woodmart/woocommerce/loop/loop-end.php
    woodmart/woocommerce/loop/loop-start.php
    woodmart/woocommerce/loop/no-products-found.php
    woodmart/woocommerce/loop/orderby.php
    woodmart/woocommerce/loop/pagination.php
    woodmart/woocommerce/loop/sale-flash.php
    woodmart/woocommerce/myaccount/form-login.php
    woodmart/woocommerce/product-searchform.php
    woodmart/woocommerce/single-product/add-to-cart/grouped.php
    woodmart/woocommerce/single-product/add-to-cart/variable.php
    woodmart/woocommerce/single-product/meta.php
    woodmart/woocommerce/single-product/product-attributes.php
    woodmart/woocommerce/single-product/product-image.php
    woodmart/woocommerce/single-product/product-thumbnails.php
    woodmart/woocommerce/single-product/rating.php
    woodmart/woocommerce/single-product/related.php
    woodmart/woocommerce/single-product/sale-flash.php
    woodmart/woocommerce/single-product/tabs/description.php
    woodmart/woocommerce/single-product/tabs/tabs.php
    woodmart/woocommerce/single-product/title.php
    woodmart/woocommerce/single-product/up-sells.php
    woodmart/woocommerce/single-product-reviews.php
    woodmart/woocommerce/single-product.php
    
    
    ### Admin ###
    
    Enabled Features: activity-panels
    analytics
    product-block-editor
    coupons
    core-profiler
    customize-store
    customer-effort-score-tracks
    import-products-task
    experimental-fashion-sample-products
    shipping-smart-defaults
    shipping-setting-tour
    homescreen
    marketing
    mobile-app-banner
    navigation
    onboarding
    onboarding-tasks
    product-variation-management
    product-virtual-downloadable
    product-external-affiliate
    product-grouped
    product-linked
    product-pre-publish-modal
    remote-inbox-notifications
    remote-free-extensions
    payment-gateway-suggestions
    shipping-label-banner
    subscriptions
    store-alerts
    transient-notices
    woo-mobile-welcome
    wc-pay-promotion
    wc-pay-welcome-page
    
    Disabled Features: minified-js
    new-product-management-experience
    product-custom-fields
    settings
    async-product-editor-category-field
    launch-your-store
    
    Daily Cron: ? Next scheduled: 2024-05-10 18:21:35 +05:30
    Options: ?
    Notes: 45
    Onboarding: completed
    
    ### Action Scheduler ###
    
    Complete: 1,087
    Oldest: 2024-04-27 18:21:41 +0000
    Newest: 2024-05-09 19:07:19 +0000
    
    Failed: 2
    Oldest: 2024-04-27 18:29:40 +0000
    Newest: 2024-04-27 18:33:28 +0000
    
    Pending: 7
    Oldest: 2024-05-09 20:07:19 +0000
    Newest: 2024-05-12 23:32:40 +0000
    
    
    ### Status report information ###
    
    Generated at: 2024-05-10 01:23:23 +05:30
    `
    Stef

    (@serafinnyc)

    Hello @venkeyaccent thanks for this.

    I see you’re using a child theme. Have you tried switching over to a default theme like Storefront and testing the upgrade then?

    Thread Starter venkeyaccent

    (@venkeyaccent)

    I switched to a default theme and got new error in theme editor in this line of code

    “syntax error, unexpected T_FUNCTION” in function wc_add_shipping_cost_to_product_price( $price, $product ) {

    here is the complete code i added in theme editor

    // Add shipping cost to product price
    function wc_add_shipping_cost_to_product_price( $price, $product ) {
    // Get the shipping cost
    $shipping_cost = 120; // Replace this with your shipping cost or a function that calculates it
    
    // Add the shipping cost to the product price
    $price_with_shipping = $price + $shipping_cost;
    
    return $price_with_shipping;
    }
    add_filter( 'woocommerce_product_get_price', 'wc_add_shipping_cost_to_product_price', 10, 2 );
    
    // Display "Free Shipping" at checkout
    function wc_free_shipping_label( $label, $method ) {
    return __( 'Free Shipping', 'woocommerce' );
    }
    add_filter( 'woocommerce_cart_shipping_method_full_label', 'wc_free_shipping_label', 10, 2 );
    

    “syntax error, unexpected T_FUNCTION” in function wc_add_shipping_cost_to_product_price( $price, $product ) {

    Are the required PHP extensions enabled for each of the 8. PHP versions you switch to?

    https://make.www.ads-software.com/hosting/handbook/server-environment/

    Thread Starter venkeyaccent

    (@venkeyaccent)

    Yes of course, I have cross checked again

    Plugin Support ckadenge (woo-hc)

    (@ckadenge)

    Hello @venkeyaccent,

    If I understand you correctly, you only have the error message appear once you have the code from line 63 activated. Is that correct?

    Have you tried updating your PHP when line 63 is commented out? If not, could you please try that and let us know how it goes.

    Once updated, you can then use an AI platform like ChatGPT for recommendations/changes to your code. This can help you solve the error message as it seems the error message is from the said code.

    Let us know how it goes.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Fatal Error If i change from PHP 7.4 to any of PHP 8.0/ 8.1/ 8.2/ 8.3’ is closed to new replies.