Classic woocommerce single product

From Lonsdale201/wp-agent-skills · View interactive version

Classic woocommerce single product is an AI agent skill from the GitHub repository Lonsdale201/wp-agent-skills. Build or audit WooCommerce single product templates in a classic PHP theme. Covers `single-product.php`, `content-single-product.php`, `woocommerce_before_single_product`, product gallery hooks, `woocommerce_single_product_summary`, add-to-cart templates for simple/variable/grouped/external products

How to use this skill

Skill file

Classic WooCommerce Single Product

Use this when building or reviewing single product pages in a classic WooCommerce theme: product gallery, summary order, add-to-cart forms, variable products, tabs, upsells, related products, reviews, and structured data.

When to Use This Skill

Single Product Skeleton

Keep the top-level single-product.php simple.

get_header( 'shop' );

do_action( 'woocommerce_before_main_content' );

while ( have_posts() ) {
	the_post();
	wc_get_template_part( 'content', 'single-product' );
}

do_action( 'woocommerce_after_main_content' );
do_action( 'woocommerce_sidebar' );

get_footer( 'shop' );

Rules:

Content Single Product Contract

content-single-product.php handles notices, password protection, product classes, gallery, summary, tabs, upsells, related products, and after-product hooks.

Must preserve:

Rules:

Summary Hook Map

Default woocommerce_single_product_summary callbacks:

Example: move price below excerpt.

add_action( 'after_setup_theme', 'mytheme_single_summary_order' );

function mytheme_single_summary_order() {
	remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 );
	add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 25 );
}

Rules:

Product Gallery

Default gallery output:

Rules:

Add-to-Cart Forms

Woo routes add-to-cart by product type:

Rules:

Variable Products

The Woo 10.x single-product/add-to-cart/variable.php template includes:

Rules:

Tabs, Upsells, Related Products

Default hooks:

Examples:

add_filter( 'woocommerce_output_related_products_args', 'mytheme_related_products_args' );

function mytheme_related_products_args( $args ) {
	$args['posts_per_page'] = 3;
	$args['columns']        = 3;

	return $args;
}

Rules:

Reviews and Comments

Product reviews use the comments system when reviews are enabled.

Rules:

Review Checklist

Common Mistakes

References

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.