Complete the code to add a custom message after the product title using a WooCommerce hook.
<?php add_action('[1]', 'custom_message_after_title'); function custom_message_after_title() { echo '<p>Thank you for checking this product!</p>'; } ?>
The hook woocommerce_after_shop_loop_item_title runs right after the product title in the product list, perfect for adding a message there.
Complete the code to change the number of products displayed per page using a WooCommerce filter.
<?php add_filter('[1]', 'custom_products_per_page'); function custom_products_per_page($cols) { return 12; } ?>
The filter loop_shop_per_page lets you set how many products show on shop pages.
Fix the error in the code to correctly remove the default WooCommerce breadcrumb.
<?php remove_action('woocommerce_before_main_content', [1], 20); ?>
The correct function to remove is woocommerce_breadcrumb, which is hooked to woocommerce_before_main_content at priority 20.
Fill both blanks to add a custom text before the add to cart button on single product pages.
<?php add_action('[1]', '[2]'); function custom_text_before_add_to_cart() { echo '<p><strong>Special offer:</strong> Free shipping today!</p>'; } ?>
The hook woocommerce_before_add_to_cart_button runs before the add to cart button. The function name must match the callback added.
Fill all three blanks to create a filter that changes the 'Add to cart' button text on product archives.
<?php add_filter('[1]', '[2]'); function [3]($text) { return 'Buy Now'; } ?>
The filter woocommerce_product_add_to_cart_text changes the button text. The function name must match the callback added.