Jigoshop Hook Tutorial: Customizing your Jigoshop price layout

I am just getting into php, but it would be nice if you could show a little bit of the architecture of headway as it applies to hooks from jigoshop. Specifically I would like to have an easy way to change the div content structure of the products/prices of jigoshop to something I can globally (within a child theme of headway) apply css to.

- Richspo – July 29, 2012

Here you go Rich =)

Jigoshop Price Layout Introduction

The jigoshop price is created by the function jigoshop_template_single_price which is found in jigoshop_template_functions.php. Here is the code snippet for that function.

<?php
function jigoshop_template_single_price( $post, $_product ) {
?>
     <p class="price"><?php echo $_product->get_price_html(); ?></p>
<?php
}
?>

Changing your Jigoshop Price Layout

1) Go into your functions.php and create your own price layout.

<?php
function my_price_function( $post, $_product ) {
?>
     <p class="my_price"><?php echo $_product->get_price_html(); ?></p>
<?php
}
?>

2) Then you will then remove the jigoshop price layout and hook your own into the Jigoshop template.

remove_action( 'jigoshop_template_single_summary', 'jigoshop_template_single_price', 10);
add_action('jigoshop_template_single_summary', 'my_price_function', 10,2);

Now if you reload the page, you should see your own css class in the product page instead of the default Jigoshop one.

Leave a reply