• I am trying again for the 4th time:

     /home/mydb/public_html/wp-content/plugins/woocommerce/templates/block-notices/error.php,
    /home/mydb/public_html/wp-content/plugins/woocommerce/templates/block-notices/notice.php,
    /home/mydb/public_html/wp-content/plugins/woocommerce/templates/block-notices/success.php,

    These are outdated. Theme is TT4 and woo is declared and marked with green hatch. I am running latest Woo. I have grabed these files and copied them into theme>templates

    In block themes there is ONLY html files inside templates.

    • Is this legacy templates?
    • I am using only block themes….
    • should they go in folder “block-notices” within theme/templates?
    • Is this important at all?
    • How can I get it out of the way once and for all from system report?

    Also

    /home/mydb/public_html/wp-content/plugins/wpc-attribute-groups/templates/product-attributes.php version 3.6.0 is out of date. The core version is 9.3.0

    This file does not exist in plugin. Does anyone at Woo know what’s wrong?

    Swatches do not show!

    • This topic was modified 1 week, 6 days ago by hebhansen.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Support RK a11n

    (@riaanknoetze)

    Hi there,

    To get a better understanding of what’s active/installed on your site, please share a copy of your status report as found under WooCommerce > Status

    Thanks!

    Thread Starter hebhansen

    (@hebhansen)

    After doing the I have a number of critical issues. 1) Turning a simple product into variable 2) Dropping the outdated templates above as instructed.

    These are the errors i find in log:

    2024-09-29T15:44:48+00:00 Critical Uncaught Error: Call to a member function date() on null in my-site/public_html/wp-content/plugins/code-snippets/php/snippet-ops.php(582) : eval()'d code:36  
    Additional context
    {
    "error": {
    "type": 1,
    "file": "my-site/public_html/wp-content/plugins/code-snippets/php/snippet-ops.php(582) : eval()'d code",
    "line": 36
    },
    "backtrace": [
    "",
    "#0 my-site/public_html/wp-includes/class-wp-hook.php(326): change_woocommerce_order_number(4587)",
    "#1 my-site/public_html/wp-includes/plugin.php(205): WP_Hook->apply_filters(4587, Array)",
    "#2 my-site/public_html/wp-content/plugins/woocommerce/includes/class-wc-order.php(528): apply_filters('woocommerce_ord...', 4587, Object(Automattic\WooCommerce\Admin\Overrides\Order))",
    "#3 my-site/public_html/wp-content/plugins/woocommerce/includes/admin/meta-boxes/class-wc-meta-box-order-data.php(222): WC_Order->get_order_number()",
    "#4 my-site/public_html/wp-admin/includes/template.php(1456): WC_Meta_Box_Order_Data::output(Object(WP_Post), Array)",
    "#5 my-site/public_html/wp-admin/edit-form-advanced.php(723): do_meta_boxes(Object(WP_Screen), 'normal', Object(WP_Post))",
    "#6 my-site/public_html/wp-admin/post-new.php(75): require('/my-site/...')",
    "#7 {main}",
    "thrown"
    ]
    }

    Checking my snippets for line 36 I have this one:

    // Virtual and Downloadable Products - Auto Complete for Immediate Access and Payment ...
    add_action('woocommerce_thankyou', 'my_autocomplete_virtual_orders', 10, 1 );
    function my_autocomplete_virtual_orders( $order_id ) {

    if( ! $order_id ) return;

    // Get the order
    $order = wc_get_order( $order_id );

    // get each product in the order
    $items = $order->get_items();

    // create and set variable
    $only_virtual = true; <------- LINE 35 IN MY SNIPPET
    <------- LINE 36 IN MY SNIPPET

    foreach ( $items as $item ) {

    // get product id
    $product = wc_get_product( $item['product_id'] );

    // is a virtual product
    $is_virtual = $product->is_virtual();

    // is a downloadable product
    $is_downloadable = $product->is_downloadable();

    if ( ! $is_virtual && ! $is_downloadable ) {

    $only_virtual = false;
    }

    }

    if ( $only_virtual ) {

    $order->update_status( 'completed' );

    }
    }

    What do I do?

    Plugin Support Shameem a11n

    (@shameemreza)

    Hi @hebhansen

    The error you’re seeing is in your code snippet for auto-completing virtual orders. The issue appears to be that the $order object is null at some point, causing the error when trying to call methods on it.

    Though writing or providing custom code is not within the scope of our support policy, you can try like this:

    // Virtual and Downloadable Products - Auto Complete for Immediate Access and Payment
    add_action('woocommerce_thankyou', 'my_autocomplete_virtual_orders', 10, 1 );
    function my_autocomplete_virtual_orders( $order_id ) {
    if (!$order_id) {
    return;
    }

    // Get the order
    $order = wc_get_order($order_id);

    // Check if order is valid
    if (!$order || is_wp_error($order)) {
    return;
    }

    // Get each product in the order
    $items = $order->get_items();

    if (empty($items)) {
    return;
    }

    // Create and set variable
    $only_virtual = true;

    foreach ($items as $item) {
    // Get product id and check if it exists
    $product = $item->get_product();

    if (!$product) {
    continue;
    }

    // Check if product is virtual or downloadable
    if (!$product->is_virtual() && !$product->is_downloadable()) {
    $only_virtual = false;
    break;
    }
    }

    if ($only_virtual) {
    $order->update_status('completed');
    }
    }

    Additionally, for the attribute groups template issue, if the file doesn’t exist in the plugin but is being reported as outdated, this could be a false positive in the system report. You should:

    • Verify you have the latest version of the WPC Attribute Groups plugin.
    • Clear your WordPress and WooCommerce cache.

    For the swatches not showing, this could be related to the template issues or could be a separate problem. To troubleshoot:

    • Ensure your theme properly supports WooCommerce.
    • Check if there are any JavaScript errors in your browser console.
    • Try temporarily switching to a default WordPress theme to see if the issue persists.

    If you are still having problems, we recommend asking development questions on the #developers channel of the WooCommerce Community Slack. Many of our developers hang out there and will be able to offer insights into your question. You can also seek help from the following:

    I wish I could help more, but hopefully, this gets you going in the right direction to get the job done.

    Thread Starter hebhansen

    (@hebhansen)

    I have added your script. I get this error when purchasing an item:

    There has been a critical error on this website.Learn more about troubleshooting WordPress.

    Nothing executes…

    Theme is TT4. It is manually declared. All plugins autoupdate, hence, they are latest official. Also woo, also theme.

    How do I check Java script errors. Chrome > Inspect > Console or? What should I see. html structure looks normal.

    Asking in your community group get’s lost. There is no ownership, commitment nor any guarantee for a reply. So basically a waste of time.

    Thread Starter hebhansen

    (@hebhansen)

    FYI: I am getting constant error on:

    wcdn_delete_file

    action_scheduler/migration_hook

    wpforms_admin_builder_templates_cache_update

    It says action failed in scheduler. Consistent fail, Will not be rescheduled…

    Plugin Support Zubair Zahid (woo-hc)

    (@doublezed2)

    Hello hebhansen,

    Thank you for your reply.

    Does the issue persist after removing the custom code?
    If so, please keep in mind that custom code falls outside our support scope.

    I recommend reaching out to a professional developer for assistance.
    You can easily find one at Codeable.io or WooExperts.

    I hope this helps.

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.