Blog Post 1
Title = Woo Commerce Theme Support and Shop Page List Page Loop Configration.
====================================================================================
/* Woo Commerce Theme Support */
function custom_add_woocommerce_support() {
add_theme_support( 'woocommerce' );
}
add_action( 'after_setup_theme', 'custom_add_woocommerce_support' );
/*
* Remove Product Link
* */
remove_action('woocommerce_before_shop_loop_item','woocommerce_template_loop_product_link_open',10);
/*
* Remove Add to Cart Button
* */
remove_action('woocommerce_after_shop_loop_item','woocommerce_template_loop_add_to_cart',10);
/*
* Add custom div before sale flash
* */
add_action('woocommerce_before_shop_loop_item_title', 'add_div_before_sale_flash', 9);
function add_div_before_sale_flash(){
echo '<div class="product-box">';
}
add_action('woocommerce_after_shop_loop_item_title', 'close_div_after_product_price', 12);
function close_div_after_product_price(){
echo '</div>';
}
/*
* Add link product image and product title
* */
add_action('woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_link_open', 9);
add_action('woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_link_close', 11);
add_action('woocommerce_shop_loop_item_title', 'woocommerce_template_loop_product_link_open', 9);
add_action('woocommerce_shop_loop_item_title', 'woocommerce_template_loop_product_link_close', 11);
/*
* Product original price and sale price reverse
* */
add_filter( 'woocommerce_format_sale_price', 'invert_formatted_sale_price', 10, 3 );
function invert_formatted_sale_price( $price, $regular_price, $sale_price ) {
return '<ins>' . ( is_numeric( $sale_price ) ? wc_price( $sale_price ) : $sale_price ) . '</ins> <del>' . ( is_numeric( $regular_price ) ? wc_price( $regular_price ) : $regular_price ) . '</del>';
}
/*
* Remove product rating
* */
remove_action('woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_rating', 5);
/*
* Add product rating
* */
add_action('woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_rating', 11);
/*
* Add Product Quantity(Liter)
* */
add_action('woocommerce_after_shop_loop_item_title', 'add_quantity_div_after_product_price', 10.1);
function add_quantity_div_after_product_price(){
echo '<div class="product_quan">'.get_field('price_per_liter').'</div>';
}
/*
* woocommerce flash sale text change
* */
add_filter('woocommerce_sale_flash', 'ds_change_sale_text');
function ds_change_sale_text() {
return '<span class="onsale">Angebot</span>';
}
/*
* To change add to cart text on single product page
* */
add_filter( 'woocommerce_product_single_add_to_cart_text', 'woocommerce_custom_single_add_to_cart_text' );
function woocommerce_custom_single_add_to_cart_text() {
return __( 'In den Warenkorb', 'woocommerce' );
}
/*
* Remove cart Total
* */
remove_action('woocommerce_cart_collaterals', 'woocommerce_cart_totals', 10);
add_action('patronus_cart_total', 'woocommerce_cart_totals');
***************************************************************************************************
Blog Post 2
Title = Some Basic JS(Function.js)
==============================================
(function ($) {
"use strict";
var $window = $(window);
var $body = $('body');
function toggleIcon(e) {
$(e.target)
.prev('.panel-heading')
.find(".more-less")
.toggleClass('glyphicon-plus glyphicon-minus');
}
$('.panel-group').on('hidden.bs.collapse', toggleIcon);
$('.panel-group').on('shown.bs.collapse', toggleIcon);
if ( ! String.prototype.getDecimals ) {
String.prototype.getDecimals = function() {
var num = this,
match = ('' + num).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);
if ( ! match ) {
return 0;
}
return Math.max( 0, ( match[1] ? match[1].length : 0 ) - ( match[2] ? +match[2] : 0 ) );
}
}
// Quantity "plus" and "minus" buttons
$( document.body ).on( 'click', '.qty-plus, .qty-minus', function() {
var $qty = $( this ).closest( '.quantity' ).find( '.qty'),
currentVal = parseFloat( $qty.val() ),
max = parseFloat( $qty.attr( 'max' ) ),
min = parseFloat( $qty.attr( 'min' ) ),
step = $qty.attr( 'step' );
// Format values
if ( ! currentVal || currentVal === '' || currentVal === 'NaN' ) currentVal = 0;
if ( max === '' || max === 'NaN' ) max = '';
if ( min === '' || min === 'NaN' ) min = 0;
if ( step === 'any' || step === '' || step === undefined || parseFloat( step ) === 'NaN' ) step = 1;
// Change the value
if ( $( this ).is( '.qty-plus' ) ) {
if ( max && ( currentVal >= max ) ) {
$qty.val( max );
} else {
$qty.val( ( currentVal + parseFloat( step )).toFixed( step.getDecimals() ) );
}
} else {
if ( min && ( currentVal <= min ) ) {
$qty.val( min );
} else if ( currentVal > 0 ) {
$qty.val( ( currentVal - parseFloat( step )).toFixed( step.getDecimals() ) );
}
}
// Trigger change event
$qty.trigger( 'change' );
});
$("#amny-custom-addto-cart-btn").click(function(e){
e.preventDefault();
$("form.cart .single_add_to_cart_button").click();
});
$("#wr-btn").click(function(){
$("#review_form_wrapper").addClass('show-write-review-form');
if($('.close-wr-popup').length==0){
$('#review_form_wrapper').append('<span class="close-wr-popup">X</span>');
}
});
$body.on('click', '.close-wr-popup', function() {
$("#review_form_wrapper").removeClass('show-write-review-form');
});
function toggleIcon(e) {
$(e.target)
.prev('.panel-heading')
.find(".more-less")
.toggleClass('glyphicon-plus glyphicon-minus');
}
$('.panel-group').on('hidden.bs.collapse', toggleIcon);
$('.panel-group').on('shown.bs.collapse', toggleIcon);
/* Sticky Cart Sidebar */
if (($(window).width() > 991) && ($('.cart-right-section').length)){
var cart_sidebar = new StickySidebar('.cart-right-section', {
topSpacing: 20,
bottomSpacing: 20,
containerSelector: '.cart-wrapper',
innerWrapperSelector: '.cart-right-total '
});
}
/* Form Label Focus */
$('.form-row :input').each(function() {
var $input = $(this);
var $row = $input.closest('.form-row');
// Is the field filled on page load?
if ($input.val()) {
$row.addClass('-filled');
}
// Enter or leave the "focus" state.
$input.on('focus', function() {
$row.addClass('-focus');
});
$input.on('blur', function() {
$row.removeClass('-focus');
});
// When the fields input value changes, add or remove the "-filled" state
$input.on('input', function() {
if ($input.val()) {
$row.addClass('-filled');
} else {
$row.removeClass('-filled');
}
});
});
/* Search Item Hide and Show */
$(document).ready(function() {
$("#search-form-hide").click(function() {
$("#search-form-show").toggle();
});
});
})(jQuery);
***************************************************************************************************
Blog Post 3
Title = Woo Commerce Product Slider Shortcode (Slider Using Slick Slider)
================================================================================
/* New Product Carousel */[Latest Product / All Product]
function new_product_slider()
{
ob_start();
$args = array(
'post_status' => 'publish',
'order' => 'DESC',
'posts_per_page' => 8
);
$products = wc_get_products( $args );
?>
<div class="new-slider-main-wraper">
<div class="new-slider-container slider">
<?php
foreach( $products as $product ){
$pro_id = $product->get_id();
$img = $product->get_image();
$product_link = get_permalink($pro_id);
?>
<div class="item">
<div class="new-pro-image">
<a href="<?php echo $product_link; ?>">
<?php echo $img; ?>
</a>
</div>
<div class="new-pro-body-content">
<div class="quick-view-btn">
<a href="<?php echo $product_link; ?>">Quick View</a>
</div>
<div class="new-pro-title">
<h3>
<a href="<?php echo $product_link; ?>"><?php echo $product->get_name(); ?></a>
</h3>
</div>
<div class="new-pro-price">
<span class="price">
<em>$</em><?php echo $product->get_regular_price(); ?>
</span>
</div>
</div>
</div>
<?php
}
?>
</div>
</div>
<?php
return ob_get_clean();
}
add_shortcode( 'new_product_slider' , 'new_product_slider' );
===================================================================================
/* Featured Product Carousel */ [ Featured Product / Star Product ]
function featured_product_slider()
{
ob_start();
$args = array(
'post_status' => 'publish',
'order' => 'DESC',
'posts_per_page' => 8,
'tax_query' => array(
array(
'taxonomy' => 'product_visibility',
'field' => 'name',
'terms' => 'featured',
'operator' => 'IN',
),
)
);
$products = wc_get_products( $args );
?>
<div class="new-slider-main-wraper featured-slider-main-wrapper">
<div class="featured-slider-container slider">
<?php
foreach( $products as $product ){
$pro_id = $product->get_id();
$img = $product->get_image();
$product_link = get_permalink($pro_id);
?>
<div class="item">
<div class="new-pro-image">
<a href="<?php echo $product_link; ?>">
<?php echo $img; ?>
</a>
</div>
<div class="new-pro-body-content">
<div class="quick-view-btn">
<a href="<?php echo $product_link; ?>">Quick View</a>
</div>
<div class="new-pro-title">
<h3>
<a href="<?php echo $product_link; ?>"><?php echo $product->get_name(); ?></a>
</h3>
</div>
<div class="new-pro-price">
<span class="price">
<em>$</em><?php echo $product->get_regular_price(); ?>
</span>
</div>
</div>
</div>
<?php
}
?>
</div>
</div>
<?php
return ob_get_clean();
}
add_shortcode( 'featured_product_slider' , 'featured_product_slider' );
***************************************************************************************************
Blog Post 4
Title = Slick Slider JS (Function.js)
(function ($) {
"use strict";
var $window = $(window);
var $body = $('body');
/* New Product Slider JS */
$(".new-slider-container").slick({
infinite: true,
dots: false,
arrows: true,
autoplay: true,
autoplaySpeed: 3000,
prevArrow:"<button type='button' class='slick-prev pull-left'><i class='fas fa-chevron-left' aria-hidden='true'></i></button>",
nextArrow:"<button type='button' class='slick-next pull-right'><i class='fas fa-chevron-right' aria-hidden='true'></i></button>",
slidesToShow: 4,
slidesToScroll: 1,
responsive: [
{
breakpoint: 991,
settings: {
slidesToShow: 2
}
},
{
breakpoint: 767,
settings: {
slidesToShow: 1
}
}
]
});
/* Feature Product Slider JS */
$(".featured-slider-container").slick({
infinite: true,
dots: false,
arrows: true,
autoplay: true,
autoplaySpeed: 3000,
prevArrow:"<button type='button' class='slick-prev pull-left'><i class='fas fa-chevron-left' aria-hidden='true'></i></button>",
nextArrow:"<button type='button' class='slick-next pull-right'><i class='fas fa-chevron-right' aria-hidden='true'></i></button>",
slidesToShow: 4,
slidesToScroll: 1,
responsive: [
{
breakpoint: 991,
settings: {
slidesToShow: 2
}
},
{
breakpoint: 767,
settings: {
slidesToShow: 1
}
}
]
});
})(jQuery);
***************************************************************************************************
Blog Post 5
Title = Slick Slider Basic CSS
===========================================================================
.new-slider-main-wraper .slick-slide {
margin: 0 17px;
}
.new-slider-main-wraper .slick-list {
margin: 0 -17px;
}
.new-slider-main-wraper .item.slick-slide{
background: #F8F8F8;
height: 100%;
}
.new-slider-main-wraper .new-pro-image a img{
aspect-ratio: 1/0.7;
object-fit: cover;
width: 100%;
}
.new-slider-main-wraper .new-pro-body-content{
padding: 30px 20px;
}
.new-slider-main-wraper .new-pro-body-content .quick-view-btn{
text-align: center;
margin-bottom: 20px;
}
.new-slider-main-wraper .new-pro-body-content .quick-view-btn a{
display: inline-block;
color: #D90000;
font-family: 'Ubuntu', sans-serif;
font-size: 16px;
font-weight: 400;
font-style: normal;
line-height: normal;
background: transparent;
border: 1px solid #D90000;
border-radius: 50px;
padding: 12px 35px;
transition: all 0.3s;
}
.new-slider-main-wraper .new-pro-body-content .quick-view-btn a:hover{
background: #D90000;
color: #fff;
border-color: #D90000;
}
.new-slider-main-wraper .new-pro-body-content .new-pro-title h3{
margin: 0;
text-align: center;
}
.new-slider-main-wraper .new-pro-body-content .new-pro-title h3,
.new-slider-main-wraper .new-pro-body-content .new-pro-title h3 a{
color: #000;
font-family: 'Ubuntu', sans-serif;
font-size: 16px;
font-weight: 400;
font-style: normal;
line-height: 1.4em;
}
.new-slider-main-wraper .new-pro-body-content .new-pro-price{
text-align: center;
margin-top: 15px;
}
.new-slider-main-wraper .new-pro-body-content .new-pro-price span.price{
color: #D90000;
font-family: "Baloo", Sans-serif;
font-size: 25px;
font-weight: 400;
font-style: normal;
line-height: 1.2em;
}
.new-slider-main-wraper .new-pro-body-content .new-pro-price span.price em{
font-style: normal;
font-size: 18px;
line-height: normal;
position: relative;
top: -3px;
margin-right: 1px;
}
.new-slider-main-wraper button.slick-arrow{
position: absolute;
bottom: auto;
top: 0;
transform: translatey(-130px);
color: #000;
text-align: center;
background-color: transparent;
border: 1px solid #E4E4E4;
padding: 0;
font-size: 22px;
border-radius: 50%;
width: 70px;
height: 70px;
display: flex;
align-items: center;
justify-content: center;
}
.new-slider-main-wraper button.slick-arrow:focus{
outline: none;
}
.new-slider-main-wraper button.slick-arrow:hover{
background: #D90000;
border-color: #D90000;
color: #fff;
}
.new-slider-main-wraper button.slick-arrow.slick-prev{
left: 0;
}
.new-slider-main-wraper button.slick-arrow.slick-next{
right: 0;
}
.new-product-inner-wrapper .elementor-widget-shortcode .elementor-widget-container,
.new-product-inner-wrapper .elementor-widget-shortcode .elementor-widget-container .elementor-shortcode,
.new-product-inner-wrapper .elementor-widget-shortcode .elementor-widget-container .elementor-shortcode .new-slider-main-wraper,
.new-product-inner-wrapper .elementor-widget-shortcode .elementor-widget-container .elementor-shortcode .new-slider-main-wraper .new-slider-container,
.new-product-inner-wrapper .elementor-widget-shortcode .elementor-widget-container .elementor-shortcode .new-slider-main-wraper .new-slider-container .slick-list.draggable,
.new-product-inner-wrapper .elementor-widget-shortcode .elementor-widget-container .elementor-shortcode .new-slider-main-wraper .new-slider-container .slick-list.draggable .slick-track{
height: 100%;
}