Skip to content

Instantly share code, notes, and snippets.

@dasbairagya
Last active May 17, 2017 12:08
Show Gist options
  • Select an option

  • Save dasbairagya/4af6f3f2c8197f44275938703df69a41 to your computer and use it in GitHub Desktop.

Select an option

Save dasbairagya/4af6f3f2c8197f44275938703df69a41 to your computer and use it in GitHub Desktop.
Woocommerce product-details page common customization
<?php if (is_single()){ ?>
<style>
/*woocommerce customization*/
.product_meta {
float: left;
clear: both;
line-height: 50px;
}
button.single_add_to_cart_button.button.alt {
width: 35%;
float: left;
}
.quantity {
width: 38%;
float: left;
clear: both;
display: inline-block;
line-height: 35px;
}
.single_add_to_cart_button.button.alt:hover{color: #fff;
background-color: #000;
}
.single_add_to_cart_button.button.alt {
background-color: transparent;
border: 1px solid #333;
padding: 12px 20px;
font-size: 1em;
display: inline-block;
padding: 8px 10px;
margin: 0;
line-height: 1.42;
font-weight: normal;
text-decoration: none;
text-align: center;
vertical-align: middle;
white-space: nowrap;
cursor: pointer;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
-o-user-select: none;
user-select: none;
-webkit-appearance: none;
-moz-appearance: none;
border-radius: 2px;
background-color: #fff;
color: #333;
font-family: cursive;
text-transform: uppercase;
letter-spacing: 1px;
font-size: 1.2em;
}
.images{
float:left;
width:48%;
}
.summary.entry-summary {
float: right;
width: 48%;
}
.woocommerce-tabs.wc-tabs-wrapper {
clear: both;
}
li.reviews_tab , li.description_tab , li.additional_information_tab {
float: left;
margin-left: 2px;
margin-right: 2px;
display: block;
background: #01b1d7;
color: black;
/* padding: 5px 10px 5px 10px; */
}
li.reviews_tab {
/*float: initial !important; */
}
div#reviews , div#tab-description ,div#tab-additional_information {
clear: both;
}
li.reviews_tab.active , li.description_tab.active , li.additional_information_tab.active
{
/* background: #a46497; */
}
li.reviews_tab.active a, li.description_tab.active a , li.additional_information_tab.active a {
color: #ccc;
text-decoration: none;
}
li.reviews_tab a, li.description_tab a, li.additional_information_tab a
{
color: black ;
}
li.reviews_tab:hover, li.description_tab:hover, li.additional_information_tab:hover
{
color: red ;
}
div.ecwid-productBrowser-relatedProducts .ecwid-productBrowser-price {
display: none;
}
</style>
<?php }?>
@dasbairagya
Copy link
Copy Markdown
Author

//pricefilter for variable product
function wc_ninja_custom_variable_price( $price, $product ) {
// Main Price
$prices = array( $product->get_variation_price( 'min', true ), $product->get_variation_price( 'max', true ) );
$price = $prices[0] !== $prices[1] ? sprintf( __( 'From: %1$s', 'woocommerce' ), wc_price( $prices[0] ) ) : wc_price( $prices[0] );

// Sale Price
$prices = array( $product->get_variation_regular_price( 'min', true ), $product->get_variation_regular_price( 'max', true ) );
sort( $prices );
$saleprice = $prices[0] !== $prices[1] ? sprintf( __( 'From: %1$s', 'woocommerce' ), wc_price( $prices[0] ) ) : wc_price( $prices[0] );

if ( $price !== $saleprice ) {
    $price = '' . $saleprice . ' ' . $price . '';
}

return $price;

}
add_filter( 'woocommerce_variable_sale_price_html', 'wc_ninja_custom_variable_price', 10, 2 );
add_filter( 'woocommerce_variable_price_html', 'wc_ninja_custom_variable_price', 10, 2 );

@dasbairagya
Copy link
Copy Markdown
Author

For tab add nav nav-tabs this class beside the tabs wc-tabs in Root dir>woocommerce>single-product>tabs>tabs.php on line no.34

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment