Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* Hook: woocommerce_dropdown_variation_attribute_options_args.
* Modify the parameters for the variation attributes.
*/
function plugin_republic_dropdown_variation_attribute_options_args( $args ) {
// Modify the $args HTML here
return $args;
}
add_filter( 'woocommerce_dropdown_variation_attribute_options_args', 'plugin_republic_dropdown_variation_attribute_options_args', 10, 1 );
<?php
/**
* Hook: woocommerce_short_description.
* Modify the HTML for the short description.
*/
function plugin_republic_short_description( $short_description ) {
// Modify the $short_description HTML here
return $short_description;
}
add_filter( 'woocommerce_short_description', 'plugin_republic_short_description', 10, 1 );
<?php
/**
* Hook: woocommerce_get_price_html.
* Modify the HTML for the product price.
*/
function plugin_republic_get_price_html( $price, $product ) {
// Modify the $price HTML here
return $price;
}
add_filter( 'woocommerce_get_price_html', 'plugin_republic_get_price_html', 10, 2 );
<?php
/**
* Hook: woocommerce_product_get_rating_html.
* Modify the HTML for the product rating.
*/
function plugin_republic_product_get_rating_html( $html, $rating, $count ) {
// Modify the $html here
return $html;
}
add_filter( 'woocommerce_product_get_rating_html', 'plugin_republic_product_get_rating_html', 10, 3 );
<?php
/**
* Hook: the_title.
* Modify the product name.
*/
function plugin_republic_the_title( $product_name, $product_id ) {
// Modify the $product_name here
return $product_name;
}
add_filter( 'the_title', 'plugin_republic_the_title', 10, 2 );
<?php
/**
* Hook: woocommerce_sale_flash.
* Update the HTML for the Sale! flash.
*/
function plugin_republic_sale_flash( $html, $post, $product ) {
// Modify the $html here
return $html;
}
add_filter( 'woocommerce_sale_flash', 'plugin_republic_sale_flash', 10, 3 );
<?php
/**
* Hook: plugin_republic_product_thumbnails_columns.
* Filter the number of columns in the thumbnail gallery.
*/
function plugin_republic_product_thumbnails_columns( $cols ) {
$cols = 3;
return $cols;
}
add_filter( 'woocommerce_product_thumbnails_columns', 'plugin_republic_product_thumbnails_columns' );
<?php
/**
* Hook: woocommerce_single_product_image_thumbnail_html.
*/
function plugin_republic_single_product_image_thumbnail_html( $html, $attachment_id ) {
// Modify $html here
return $html;
}
add_filter( 'woocommerce_single_product_image_thumbnail_html', 'plugin_republic_single_product_image_thumbnail_html', 10, 2 );
<?php
/**
* Hook: woocommerce_before_single_product.
*
* @hooked woocommerce_output_all_notices - 10
* add_action( 'woocommerce_before_single_product', 'woocommerce_output_all_notices', 10 );
*/
do_action( 'woocommerce_before_single_product' );
?>