Skip to content

Instantly share code, notes, and snippets.

@kontikidigital
kontikidigital / functions.php
Last active January 14, 2021 09:42
WooCommerce: Change Select Options Button Text for variable products
add_filter( 'woocommerce_product_add_to_cart_text' , 'custom_woocommerce_product_add_to_cart_text' );
/**
* custom_woocommerce_template_loop_add_to_cart
*/
function custom_woocommerce_product_add_to_cart_text() {
global $product;
$product_type = $product->get_type();
switch ( $product_type ) {
@JeroenSormani
JeroenSormani / woocommerce-store-wide-disable-sales.php
Last active April 10, 2024 12:45
WC disable sale on all products.
<?php
/**
* Disable all sales.
*
* A simple function to disable all the sales in the shop.
* Uncomment the line of code to disable the sale price on products.
*/
function custom_wc_get_sale_price( $sale_price, $product ) {
@sakinshrestha
sakinshrestha / woocommerce-cart-mobile.css
Created January 7, 2016 02:46
WooCommerce Cart Table Responsive for Mobile
/* START Make the WooCommerce Cart Table Responsive for Mobile */
/* CSS published in http://www.jeremycarter.com.au/optimising-woocommerce-checkout-for-mobile/ */
@media screen and (max-width: 600px) {
/* Force table to not be like tables anymore */
.woocommerce-page table.shop_table,
.woocommerce-page table.shop_table thead,
.woocommerce-page table.shop_table tbody,
.woocommerce-page table.shop_table th,
.woocommerce-page table.shop_table td,
@bekarice
bekarice / wc-product-price-display.php
Created January 4, 2016 00:23
Add labels to WooCommerce Product price
<?php
// only copy opening php tag if needed
// Adds "per package" after each product price throughout the shop
function sv_change_product_price_display( $price ) {
$price .= ' per package';
return $price;
}
add_filter( 'woocommerce_get_price_html', 'sv_change_product_price_display' );
add_filter( 'woocommerce_cart_item_price', 'sv_change_product_price_display' );
@yratof
yratof / functions.php
Last active March 23, 2017 21:44
Woocommerce: Show % saved
<?php
/**
* Add save percent next to sale item prices,
* wrapped in a span + strong for CSS
* targeting with .saving{} and .saving strong{}
*/
add_filter( 'woocommerce_sale_price_html', 'woocommerce_sales_price_saving', 10, 2 );
function woocommerce_sales_price_saving( $price, $product ) {
$percentage = round( ( ( $product->regular_price - $product->sale_price ) / $product->regular_price ) * 100 );
@bekarice
bekarice / wc-require-cat-minimum.php
Created December 9, 2015 08:00
WooCommerce Require Category Minimum for Purchase
<?php
/**
* only copy the opening php tag if needed
* tutorial at: http://swwp.co/6l
*/
/**
* Renders notices and prevents checkout if the cart
* does not contain a minimum number of products in a category
*/
@blivic
blivic / mx-wc-cf7-inquiry-tab.php
Last active March 24, 2017 13:23
Woocommerce - adding inquiry tab using CF7
// Filter za dodavanje taba za upit o proizvodu
add_filter( 'woocommerce_product_tabs', 'product_enquiry_tab' );
function product_enquiry_tab( $tabs ) {
$tabs['test_tab'] = array(
'title' => __( 'Upit o proizvodu', 'woocommerce' ),
'priority' => 40,
'callback' => 'product_enquiry_tab_form'
);
add_filter( 'woocommerce_product_tabs', 'woo_edit_tabs' );
function woo_edit_tabs( $tabs ) {
// Adds the new tab
$tabs['enquiry_form'] = array(
'title' => __( 'Ask a question', 'woocommerce' ),
'priority' => 50,
'callback' => 'woo_enquiry_form'
);
@devinsays
devinsays / woo-optimizely.php
Created September 11, 2015 21:13
Optimizely Integration with WooCommerce
<?php
// Loads Optimizely and sends revenue information on conversion page.
// Replace Optimizely script with your own ID.
function optimizely_revenue_tracking( $order_id ) {
// Lets grab the order
$order = new WC_Order( $order_id );
$price = $order->get_total();
?>
@fliphess
fliphess / wordpress-hacks.md
Last active September 13, 2018 13:44
Wordpress hacks

Tips en Tricks om wordpress sneller en veiliger te maken.

Dit is een list met truuks om wordpress snel(ler) en veilig(er) te maken.

Alle tips zijn welkom :)

Wat iig een fijn aanknopingspunt is, is PageSpeed & YSlow. Zij maken gebruik van de best practises van yahoo en google en hebben een aantal goede tips die nog flink wat snelheid op kunnen leveren. http://gtmetrix.com

Tips