Woocommerce

WooCommerce Theme modification

  1. Installation
  2. Upload products from plugins/woocommerce/sample_products.csv (wp-admin > tools > import > Woocommerce products(CSV))
  3. For Woocommerce theme support. functions.php > "after_setup_them" hook >
    add_theme_support("woocommerce",
          	array(
            	"thumbnail_image_width" => 150,
            	"single_image_width" => 200,
                “product_grid”=>array()
            )
          );

    Before theme support, shop and single product will be displayed by theme's index.php

    After theme support, shop > archive-product.php and single > single-product.php from plugin's directory

  4. Understanding do_action()
    function sample_function() {
    }
    add_action(“my_action_name”, “sample_function”, priority);
    do_action(“my_action_name”); //Do action triggers the action named my_action_name
    remove_action(“hook_name”, “function_name”);
  5. Copy plugins/woocommerce/templates folder and paste to theme’s root. Rename templates > woocommerce.
  6. For single product page
    • add_theme_support(‘wc-product-gallery-zoom’);
    • add_theme_support(‘wc-product-gallery-lightbox’);
    • add_theme_support(‘wc-product-gallery-slider’);
  7. Edit single product page: single-product.php, single-product. Within this folder all the parts are available.
  8. There is no specific template for cart page. It is rendered in page.php. There is a ‘cart’ folder within woocommerce folder.
    Edit: Inspect and copy the style and edit with custom CSS
  9. checkout: It is rendered in page.php. There is a ‘checkout’ folder within woocommerce folder.
    Edit: Inspect and copy the style and edit with custom CSS. Also you can edit checkout/form-checkout.php
  10. Activate Payment: WooCommerce > Settings > Payments
  11. My Account: Rendered by page.php. Inspect and edit.

@woocommerce/woocommerce-rest-api

  1. Error for 'buffer' package
    pnpm install buffer
  2. Error for 'stream'
    npm install stream-browserify

    Add the following line withing resolve of webpack

    fallback: {
    	stream: require.resolve('stream-browserify'),
    },
  3. Error at Hmac.CipherBase
    • Load the website in incognito with new login
    • Worked on virtual host but displayed unauthorized on localhost:3000
© copyright-2020 Rejaul