Research Notes for a e-Commerce Class. How to set up WooCommerce with sample data, fake payment and block based editors.
The Sample data for WooCommerce is located in sample-products.csv or sample-products.xml, which are located in the WooCommerce plugin folder in woocommerce/sample-data/
Check this article.
An alternative is this file.
Video
FakerPress is used in the video above
FakePay for WooCommerce
The video has an interesting feature: a functions.php hack that will enable Gutenberg (and other page builders) in WooCommerce. However, the authors tell, that this way of doing things may become deprecated soon.
Edit Products in Gutenberg
Enable Gutenberg
Note: this code could be deprecated soon.
Add this to functions.php:
// enable gutenberg for 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 );
// enable taxonomy fields for woocommerce with gutenberg on
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' );