Category: Woocommerce

  • What to do when you can’t upload CSV files with WooCommerce

    What to do when you can’t upload CSV files with WooCommerce

    Today I will write about what to do when you cannot import a CSV file when importing products in WooCommerce. A message like the one below appears. “You do not have permission to upload this file type.”

    1 1024x696 1

    In this case, install the following plugin.

    “WP Add Mime Types”

    Once installed, add the following string to the additional items field on the settings screen and save.

    「csv = text/csv」

    3 1024x701 1

    Then try importing the CSV file again and it will be able to import.

  • How to reduce items on WooCommerce checkout page

    How to reduce items on WooCommerce checkout page

    I will show you how to delete unnecessary items on the WooCommerce checkout page. Just put the following code in your theme’s functions.php and save/update. By entering this, all input other than first name, last name, company name (optional), and email address will be deleted. This is ideal if you are selling virtual products. Please feel free to adjust any items you need.

    // Remove billing details from woocommerce checkout field
                  add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );
                  function custom_override_checkout_fields( $fields ) {
                              unset($fields['order']['order_comments']);
                              unset($fields['billing']['billing_address_1']);
                              unset($fields['billing']['billing_address_2']);
                              unset($fields['billing']['billing_city']);
                              unset($fields['billing']['billing_postcode']);
                              unset($fields['billing']['billing_country']);
                              unset($fields['billing']['billing_state']);
                              unset($fields['billing']['billing_phone']);
                              unset($fields['billing']['billing_address_2']);
                              unset($fields['billing']['billing_postcode']);
                              unset($fields['billing']['billing_city']);
                              return $fields;
                          }
                  add_filter('woocommerce_enable_order_notes_field', '__return_false');
  • [WordPress] Why I separate posts and custom post types

    [WordPress] Why I separate posts and custom post types

    The reason I started separating posts and custom post types stems from an experience I had with the WooCommerce Membership plugin in the past.

    When I tried to write member-only articles using the WooCommerce Membership plugin, I discovered a significant bug. The issue was that even locked posts could be viewed via the WordPress app. I learned that this happened because the WordPress app retrieves “posts” using an API. As a result, if you write something as a regular post, it might be accessible through the WordPress app or Feedly, potentially exposing content meant to be kept secret.

    With this in mind, I developed my current approach: articles that I want to announce updates for are categorized as “posts,” while those that I don’t want to announce updates for are categorized as “custom post types.” Although I’m not currently writing member-only articles, I might do so in the future. Moreover, there are times when I don’t want to announce updates for certain articles. In such cases, I use “custom post types” to publish those articles.

  • How to enable Gutenberg Editor in WooCommerce

    How to enable Gutenberg Editor in WooCommerce

    If you put the code below in functions.php and save it, you will be able to use Gutenberg Editor with WooCommerce.

    // Enable Gutenberg on Woocommerce
    function activate_gutenberg_product( $can_edit, $post_type ) {
     if ( $post_type == 'product' ) {
            $can_edit = true;
        }
        return $can_edit;
    }
    add_filter( 'use_block_editor_for_post_type', 'activate_gutenberg_product', 10, 2 );
    
    // Turn on Gutenberg and enable taxonomy fields for woocommerce
    function enable_taxonomy_rest( $args ) {
        $args['show_in_rest'] = true;
        return $args;
    }
    add_filter( 'woocommerce_taxonomy_args_product_cat', 'enable_taxonomy_rest' );
    add_filter( 'woocommerce_taxonomy_args_product_tag', 'enable_taxonomy_rest' );
  • How to fix Gutenberg Editor broken on update to WooCommerce 7.7

    How to fix Gutenberg Editor broken on update to WooCommerce 7.7

    I was using Gutenberg with WooCommerce by following the instructions on How to enable Gutenberg Editor in WooCommerce, but after updating to WooCommerce version 7.7, I can no longer edit products. After investigating, I was able to resolve the issue by adding the following code to functions.php.

    // Temporary Solution
    add_filter('woocommerce_register_post_type_product', function( $args ) {
        unset( $args['template'] );
        return $args;
    });

    https://wordpress.org/support/topic/woocommerce-product-tab-locked-version-7-7-0

    note: This appears to be a temporary solution only. You may need to remove this code in future WooCommerce versions.

  • I’m trying Block Based Checkout with WooCommerce, but it says it’s not supported by PayPal. Do you know when it will be available?

    I’m trying Block Based Checkout with WooCommerce, but it says it’s not supported by PayPal. Do you know when it will be available?

    It’s good to look here.
    https://github.com/woocommerce/woocommerce-paypal-payments/issues/211

    It doesn’t seem to be supported at the moment. However, I wonder if it will be supported when WooCommerce Blocks becomes part of WooCommerce rather than a separate plugin.

  • Configuration when using WooCommerce and W3 Total Cache together.

    Configuration when using WooCommerce and W3 Total Cache together.

    If you want to use W3 Total Cache but have installed the WooCommerce plugin, I will introduce settings to prevent customer information from being cached.

    (more…)
  • How to sell paid articles on WordPress

    How to sell paid articles on WordPress

    This time I will introduce a plugin that I use to sell paid articles. To use this plugin, use WooCommerce’s shop system. And since you need your readers to create an account, you need to uncheck WooCommerce –> Settings –> Accounts & Privacy –> “Allow customers to place orders even if they don’t have an account.”

    So, what plugin are you using? It’s a plugin called Pay For Post with WooCommerce. First, install WooCommerce, then install Pay For Post with WooCommerce. After creating a post, before publishing it, create a product in WooCommerce. Make it into a virtual product and publish it. After that, go back to the post and link the WooCommerce product you created with the article.

  • How to prevent WooCommerce products from being displayed when searching from the WordPress regular search widget

    How to prevent WooCommerce products from being displayed when searching from the WordPress regular search widget

    If you have WooCommerce installed in WordPress, all posts, pages, and products will be displayed when you search from the regular search widget. Today I will introduce a code that does not display the product and page when searching from the regular search widget. Put the following code in functions.php.

    /** Remove WooCommerce products and WordPress page results from search form widget */
       function mycustom_modify_search_query( $query ) {
         // Make sure this isn't the admin or is the main query
         if( is_admin() || ! $query->is_main_query() ) {
           return;
         }
         // Make sure it is not a WooCommerce product search form
         if( isset($_GET['post_type']) && ($_GET['post_type'] == 'product') ) {
           return;
         }
         if( $query->is_search() ) {
           $in_search_post_types = get_post_types( array( 'exclude_from_search' => false ) );
           // Type of post to delete (Example: "product" and "page")
           $post_types_to_remove = array( 'product', 'page' );
           foreach( $post_types_to_remove as $post_type_to_remove ) {
             if( is_array( $in_search_post_types ) && in_array( $post_type_to_remove, $in_search_post_types ) ) {
               unset( $in_search_post_types[ $post_type_to_remove ] );
               $query->set( 'post_type', $in_search_post_types );
             }
           }
         }
       }
       add_action( 'pre_get_posts', 'mycustom_modify_search_query' );