This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /* | |
| Plugin Name: Remove product-category slug | |
| Plugin URI: https://timersys.com/ | |
| Description: Check if url slug matches a woocommerce product category and use it instead | |
| Version: 0.1 | |
| Author: Timersys | |
| License: GPLv2 or later | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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 ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* 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, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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' ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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 ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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 | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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' | |
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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' | |
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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(); | |
| ?> |