isodos
Forum Replies Created
-
Forum: Plugins
In reply to: [WooCommerce] Issue with product variationsThe error logs you’ve shared indicate a recurring critical error related to the WooCommerce Cart Tab plugin on your WordPress site. Specifically, the error “Call to a member function
get_cart_contents_count()
on null” suggests that the plugin is trying to call a function on a non-existent object, likely because the WooCommerce cart object isn’t initialized or available at the time the plugin expects it to be.Make sure everything is up to date.
Since you’ve identified that the issue persists with only WooCommerce, Woodmart theme, and WP Rocket (and the error specifically mentions the WooCommerce Cart Tab plugin), it’s important to test without WP Rocket as well to rule out caching issues causing the cart object to not initialize properly.
If comfortable, delve deeper into debugging by checking the plugin’s source code where the error occurs (
woocommerce-cart-tab/includes/cart-tab-templates.php
on line 13). See if there are conditions where the WooCommerce global object could be null and why.Since the issue is directly related to the WooCommerce Cart Tab plugin, consider reaching out to the plugin’s support team with the error logs. They might have encountered this issue before and could provide a patch or workaround.
Forum: Plugins
In reply to: [WooCommerce] Product Search Result Issue (the results do not match)This is very common and normal behaviour for WooCommerce. The search mechanism considers product descriptions or other fields beyond just the product title in other products, so if you have other items in the shop with the same name in the title “iPhone 12, iPhone 13, etc” or in the product short/long descriptions, this would occur.
To ensure search results are more relevant and focused on the keywords entered, you might need to adjust how the search query is processed on your site.
Here are several approaches to refine the search functionality:
Custom code: This can be achieved with custom code added to your child theme’s
functions.php
file:function custom_search_exact_match($search, $wp_query) { global $wpdb; if (!empty($search) && !is_admin() && $wp_query->is_search && $wp_query->is_main_query()) { $keywords = $wp_query->query_vars['s']; // Modify the search query to search for an exact match in post titles. $search = " AND {$wpdb->posts}.post_title = '" . esc_sql($wpdb->esc_like($keywords)) . "'"; } return $search; } add_filter('posts_search', 'custom_search_exact_match', 10, 2);
This code is quite simplistic and makes the search strictly match the exact title, which might be too restrictive for some use cases. It’s a starting point and might need adjustments to fit your exact needs.
Or.. Use a Custom Search Plugin:
Consider using a search plugin like SearchWP or Relevanssi. These plugins offer advanced control over the search algorithm, including the ability to set “exact match” rules. You can configure them to prioritize exact matches in product titles over partial matches or content found in descriptions and other metadata.
Good luck mate!
Forum: Plugins
In reply to: [WooCommerce] wp.data undefined in WooCommerce 8.5.2
The issue you’re experiencing withwp.data
being undefined for anonymous users after updating WooCommerce and using WP Rocket for caching, combined with the Woodmart theme, is indicative of a JavaScript loading or execution timing issue. This can happen when scripts that rely onwp.data
are executed beforewp.data
itself is fully loaded, especially when JS loading optimizations like deferring or delaying execution are applied.Given that disabling the defer and delay options in WP Rocket resolves the issue but adversely affects your site’s performance, here are some strategies to tackle the problem without sacrificing page speed:
1. Selective Script Exclusion from Defer/Delay
- Identify Critical Scripts: Determine which scripts are crucial for
wp.data
and ensure they are not deferred or delayed. You might need to manually exclude these specific scripts from WP Rocket’s optimization features. - WP Rocket Exclusion: In WP Rocket, you can exclude specific JavaScript files from being deferred or delayed. This is done under the File Optimization tab, where you can specify scripts by their relative paths.
2. Async Loading with Dependency Management
- Ensure Dependencies Are Met: If possible, modify how scripts are enqueued in WordPress to ensure that they explicitly declare
wp.data
as a dependency. This might require custom code or a child theme to adjust the script enqueue functions.
3. Use of the
rocket_delay_js_exclusions
Filter- Custom Filter for Exclusions: WP Rocket allows you to exclude scripts from delay using the
rocket_delay_js_exclusions
filter. You can add a custom function to your theme’sfunctions.php
file or a site-specific plugin to exclude scripts related to WooCommerce andwp.data
.
4. Optimize Loading with Inline Scripts
- Inline Critical JS: For essential inline scripts that depend on
wp.data
, ensure they are placed in a way that they execute afterwp.data
is available. This might involve moving inline scripts to the footer or after the WP Rocket script that initializes deferred scripts.
5. Contact Theme and Plugin Developers
- Report the Issue: Since this issue persists with just WooCommerce, Woodmart theme, and WP Rocket activated, reaching out to the developers with detailed information might prompt them to investigate potential compatibility issues or offer a patch/update.
6. Monitoring and Testing
- Use Browser DevTools: Utilize your browser’s developer tools to monitor the loading order of scripts. This can help identify if critical scripts are loading too late due to deferring or delay optimizations.
- Incremental Changes: Make one change at a time and test the site’s functionality and performance to pinpoint the most effective solution without compromising site speed.
7. Alternative Performance Optimization
- Reevaluate Caching and Optimization Settings: If specific exclusions don’t fully resolve the issue, consider adjusting other WP Rocket settings, like cache lifespan, file optimization levels, or using its Critical Path CSS generation feature to improve load times without affecting script execution.
Forum: Plugins
In reply to: [WooCommerce] Conflict between Rank Math and WooCommerce1. Ensure Everything is Up-to-Date
First, ensure that both WooCommerce and Rank Math, along with your theme and other plugins, are updated to their latest versions. Sometimes, compatibility issues are resolved in the latest updates. Especially if your theme has a CORE update. This is very common.
2. Check Theme Compatibility
Switch to a default WordPress theme (like Twenty Twenty-One) temporarily to rule out any theme-related conflicts. If the issue resolves, the problem might be with the theme’s compatibility/hooks with either WooCommerce or Rank Math.
3. Enable WordPress Debugging
Enabling WP_DEBUG can help identify any specific errors that occur when both plugins are active. Add the following code to your
wp-config.php
file and then post the results in this thread:define( 'WP_DEBUG', true ); define( 'WP_DEBUG_LOG', true ); define( 'WP_DEBUG_DISPLAY', false );
After adding this, try to reproduce the issue by activating both plugins. Then, check the
wp-content/debug.log
file for any relevant error messages and paste them here if you can’t figure it out.4. Check for JavaScript Errors
Use your browser’s developer tools to check for JavaScript errors in the console when both plugins are activated. JavaScript issues can often lead to functionality problems in WordPress admin. Post those here, as well (if any).
As a last resort, if the issue significantly impacts your site and a timely fix isn’t available, consider temporarily using an alternative SEO plugin until the conflict is resolved.
Forum: Plugins
In reply to: [WooCommerce] How to connect WeChat Pay and AliPay?
To accept payments via WeChat Pay and AliPay on your WooCommerce site, you’ll need to go through a few specific steps, as these payment methods are not natively integrated into WooCommerce like PayPal and Stripe. Here’s how you can proceed:1. Stripe Integration for WeChat Pay and AliPay
Stripe does support WeChat Pay and AliPay as payment methods, but the availability can depend on your business location and Stripe account settings. To use these payment methods through Stripe, you would:
- Check Availability: First, ensure that WeChat Pay and AliPay are available for your Stripe account. Stripe’s support for these payment methods might be limited to certain countries or require specific account configurations.
- Configure in Stripe: If available, you would need to configure WeChat Pay and AliPay within your Stripe dashboard. This typically involves enabling these payment methods from the Stripe settings. Sometimes they want further verification but it’ll advise you at the time of enabling these in settings.
- Stripe Integration with WooCommerce: If your WooCommerce site is already integrated with Stripe, and you’ve enabled WeChat Pay and AliPay in your Stripe account settings, transactions made through these methods could be processed via Stripe. If not, find a plugin that supports WeChat and AliPay using Stripe (there are many out there, free).
Good luck mate!
Forum: Plugins
In reply to: [WooCommerce] invalid ISO 4217 currency code – GELIf you’re comfortable with adding custom code to your site, you can use a function to explicitly declare “GEL” as the currency code. Here’s an example for WooCommerce that you can add to your theme’s functions.php file:
add_filter('woocommerce_currencies', 'add_custom_currency'); add_filter('woocommerce_currency_symbol', 'add_custom_currency_symbol', 10, 2); function add_custom_currency($currencies) { $currencies['GEL'] = __('Georgian Lari', 'woocommerce'); return $currencies; } function add_custom_currency_symbol($currency_symbol, $currency) { switch ($currency) { case 'GEL': $currency_symbol = '?'; break; // Add your currency symbol if needed } return $currency_symbol; }
Forum: Plugins
In reply to: [WooCommerce] Conflict with theme stylesYou can add custom code to your theme’s
functions.php
file to disable WooCommerce styles. Insert the following code:add_filter( 'woocommerce_enqueue_styles', '__return_false' );
Forum: Plugins
In reply to: [WooCommerce] orders completed but not appearing in woocommerce1. Check WooCommerce Status
- Go to WooCommerce > Status in your WordPress dashboard. Look for any notices or errors that could indicate problems with your WooCommerce installation, such as database updates required or issues with the WooCommerce database tables.
2. Ensure Data Synchronization
- WooCommerce Analytics relies on a process that synchronizes order data. If this process is interrupted or fails, your analytics won’t be up to date.
- You can force a data re-sync by going to WooCommerce > Status > Tools and looking for the tool to Recount Orders or Regenerate Shop Lookup Tables. These tools can help ensure that your analytics data is up-to-date.
3. Clear Transients
- WooCommerce uses transients to store temporary data. If these get corrupted or outdated, it could affect what’s displayed in your analytics.
- Still under WooCommerce > Status > Tools, you’ll find an option to Clear Transients. Clearing them can resolve issues stemming from stale data.
4. Check Analytics Settings
- Since you’ve mentioned checking analytics settings, ensure that the date range in the Analytics section includes the recent days where orders were placed.
- Also, verify if any filters are applied that might be excluding the recent orders from the view.
5. Plugin Conflicts
- If you’ve recently installed or updated other plugins, there might be a conflict affecting WooCommerce Analytics. You can troubleshoot this by deactivating other plugins temporarily and checking if the issue resolves. If it does, reactivate them one by one to identify the culprit.
6. Theme Conflicts
- Similarly, a theme update or change could introduce issues. Test with a default WordPress theme (like Twenty Twenty-One) to rule out theme-related problems.
7. Update WooCommerce
- Ensure WooCommerce and all related plugins are updated to their latest versions. Sometimes, issues are resolved in newer versions of the software.
8. Custom Code
- If you have custom code snippets added to your theme’s
functions.php
file or a site-specific plugin, these could also interfere with WooCommerce operations. Review any recent customizations for potential issues.
9. Debugging – lastly you’ll need to debug to see why this is occuring.
- Enable WordPress debugging by adding the following lines to your
wp-config.php
file:phpCopy codedefine('WP_DEBUG', true); define('WP_DEBUG_LOG', true); define('WP_DEBUG_DISPLAY', false);
This change will log any errors to a file (wp-content/debug.log
) rather than displaying them on your site. Reviewing this log can provide insights into any underlying issues.
Forum: Plugins
In reply to: [WooCommerce] Multiple IssuesYou have to add this as additional css and perhaps declare the class as important.
Forum: Plugins
In reply to: [WooCommerce] Importing 25 subscriptions
Hi Nobby,For importing subscribers into a WooCommerce site specifically, you can leverage WordPress and WooCommerce functionalities with a bit of custom PHP code. However, since subscribers are essentially WordPress users with a specific role, you’ll be working with WordPress user functions primarily.
Here’s a simple approach using a custom PHP script. This script reads your CSV file and imports each subscriber as a WordPress user with the role of ‘customer’ (commonly used by WooCommerce for customers/subscribers). Before proceeding, ensure your CSV is formatted with the necessary columns (e.g., email, first name, last name). Adjust the column names in the script as needed to match your CSV.
Make sure your CSV file has headers that at least include
email
,first_name
, andlast_name
. Adjust your CSV or the script according to the data you have.You can then add the following code to your theme’s
functions.php
file and run your import. This code will:- Add a new page to the Tools menu in the WordPress admin for importing subscribers from a CSV file.
- Provide an upload form on this new page.
- Handle the file upload securely, with basic validation and sanitization.
- Process the CSV file to create or update users with the role of ‘customer’.
function csv_importer_admin_menu() { add_management_page('Import CSV', 'Import CSV', 'manage_options', 'import-csv', 'csv_importer_upload_form'); } add_action('admin_menu', 'csv_importer_admin_menu'); function csv_importer_upload_form() { ?> <div class="wrap"> <h2>Import Subscribers from CSV</h2> <form method="post" enctype="multipart/form-data"> <input type="file" name="csv_import" id="csv_import" accept=".csv"> <?php submit_button('Import CSV'); ?> </form> </div> <?php } function csv_importer_handle_upload() { if (isset($_FILES['csv_import']) && current_user_can('manage_options')) { if ($_FILES['csv_import']['error'] === UPLOAD_ERR_OK && $_FILES['csv_import']['type'] === 'text/csv') { $csv_path = $_FILES['csv_import']['tmp_name']; $handle = fopen($csv_path, 'r'); if ($handle !== FALSE) { fgetcsv($handle); // Assuming the first row contains headers while (($data = fgetcsv($handle, 1000, ',')) !== FALSE) { $email = sanitize_email($data[0]); $first_name = sanitize_text_field($data[1]); $last_name = sanitize_text_field($data[2]); if (!email_exists($email)) { $user_id = wp_create_user($email, wp_generate_password(), $email); wp_update_user([ 'ID' => $user_id, 'first_name' => $first_name, 'last_name' => $last_name, 'role' => 'customer' ]); } } fclose($handle); add_action('admin_notices', function() { echo '<div class="updated"><p>Subscribers imported successfully.</p></div>'; }); } } else { add_action('admin_notices', function() { echo '<div class="error"><p>There was an error with the upload. Please ensure you are uploading a CSV file.</p></div>'; }); } } } add_action('admin_init', 'csv_importer_handle_upload');
Forum: Plugins
In reply to: [WooCommerce] Multiple Issues- The default sorting box is showing for me on your shop page
- The pagination can’t have css declared as display: block when you’re wanting to justify content to center. Therefore, you’ll need to declare display as flex, as shown in my screenshot.
3. Not seeing category tiles anywhere.
Good luck mate.
Forum: Plugins
In reply to: [WooCommerce] Woocommerce order received pageSometimes, redirection issues can be caused by permalink settings. Go to WordPress Admin > Settings > Permalinks and simply click “Save Changes” without making any changes. This action flushes the permalink structure and can resolve routing issues.
If that doesn’t work, make sure that the thank you page php is structured correctly:
<?php defined( 'ABSPATH' ) || exit; global $wp; // Check if the order exists. if ( isset( $wp->query_vars['order-received'] ) ) { $order_id = absint( $wp->query_vars['order-received'] ); } else { $order_id = 0; } $order = wc_get_order( $order_id ); if ( $order && $order->has_status( 'completed' ) ) { // Your customizations here. For example: echo '<p>Thank you. Your order has been received.</p>'; // Display order details. echo '<ul>'; echo '<li>Order number: ' . $order->get_order_number() . '</li>'; echo '<li>Date: ' . wc_format_datetime( $order->get_date_created() ) . '</li>'; echo '<li>Email: ' . $order->get_billing_email() . '</li>'; echo '<li>Total: ' . $order->get_formatted_order_total() . '</li>'; echo '<li>Payment method: ' . $order->get_payment_method_title() . '</li>'; echo '</ul>'; // Display additional information - e.g., customer details, products ordered. // This part is highly customizable depending on what details you want to show. } else { // If order not found or not completed. echo '<p>Order not found or has not been completed.</p>'; }
Forum: Plugins
In reply to: [WooCommerce] orders completed but not appearing in woocommerceDid you check the analytic settings to ensure the statuses are not being excluded, etc?
Forum: Fixing WordPress
In reply to: This code shows at the top of every page- Use Developer Tools: Browsers’ developer tools can help identify where the issue is originating from. Look for errors in the Console tab that might point you towards the problematic script or resource.
- Font Awesome Conflict: Since “fa-solid” is mentioned, there might be an issue with how Font Awesome icons are being called or loaded. Ensure you’re using the correct version of Font Awesome and that it’s properly enqueued in your theme’s functions file.
Forum: Fixing WordPress
In reply to: REST API Users not show informationEnable WordPress debugging to see if any errors are logged when making the API request. This can provide clues if something is failing silently in the background.
Plugin Updates or Conflicts: If the bearer token authentication plugin or any other plugin related to REST API functionality was recently updated, the update might have changed how user data is accessed or exposed. Check the changelogs of these plugins for any such changes. Additionally, try deactivating other plugins temporarily to see if there’s a conflict affecting the API’s response.
Reauthentication: Try reauthenticating or generating a new bearer token to ensure that the issue isn’t related to an expired or invalidated token.Given the details you’ve shared, particularly the mention of “is_super_admin”: true and the fact that this issue arose recently, it suggests that the problem might be related to either a configuration change or an update to WordPress or one of your plugins. If none of the above steps help, you may need to directly consult with a developer, if you want you can consult with me via PM.
- Identify Critical Scripts: Determine which scripts are crucial for