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
/** | |
* Hide R1 field for customers outside HR | |
**/ | |
add_action( 'woocommerce_after_checkout_form', 'mx_show_r1_4hr' ); | |
function mx_show_r1_4hr(){ | |
if ( is_checkout() ) { | |
?> | |
<script> | |
jQuery(document).ready(function($){ |
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
function mx_text_bellow_product_thumbs() { | |
echo '<div class="woocommerce-text-under-thumbs" style="background: #fdfd5a; padding: 1em 2em; clear: left;float: left; max-width: 300px; font-size: 0.7em;">'; | |
echo '<span>ADD TEXT, IMAGES AND ANY HTML</span>'; | |
echo '</div>'; | |
} | |
add_action( 'woocommerce_before_single_product_summary', 'mx_text_bellow_product_thumbs' , 21); |
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
function mx_local_pickup_instructions_order_email( $order, $sent_to_admin, $plain_text, $email ) { | |
// Only for processing and completed email notifications to customer | |
if( ! ( 'customer_processing_order' == $email->id || 'customer_completed_order' == $email->id ) ) return; | |
foreach( $order->get_items('shipping') as $shipping_item ){ | |
$shipping_rate_id = $shipping_item->get_method_id(); | |
$method_array = explode(':', $shipping_rate_id ); | |
$shipping_method_id = reset($method_array); | |
if( 'local_pickup' == $shipping_method_id ){ | |
?><h2>Ime trgovine</h2> |
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
function mx_local_pickup_instructions_thank_you_page( $order_id ) { | |
$order = wc_get_order( $order_id ); | |
$order_methods = array_map( function( $shipping ) { return $shipping->get_method_id(); }, $order->get_shipping_methods() ); | |
if ( in_array( 'local_pickup', $order_methods ) ) { | |
?><h2>Ime trgovine</h2> | |
<p>Naručene artikle možete preuzeti u našoj trgovini.</p> | |
<p> | |
Moja ulica b.b.<br/> | |
52100, Pula<br/> | |
+385 99 123456<br/><br/> |
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: MX Woo BACS | |
Plugin URI: https://media-x.hr | |
Description: Poboljšane upute za plaćanje putem direktne bankovne transakcije | |
Version: 1.0 | |
Author: Media X | |
WC requires at least: 3.0 | |
WC tested up to: 3.6.4 | |
Author URI: http://media-x.hr |
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 | |
/** | |
* DO NOT copy the opening php tag | |
* check if you're using the correct attribute slug | |
*/ | |
add_action('woocommerce_after_shop_loop_item','display_size_attribute_in_shop'); | |
function display_size_attribute_in_shop() { | |
global $product; | |
if( $product->is_type('variable') ){ |
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_action( 'woocommerce_cart_calculate_fees', 'mx_add_cod_fee', 20, 1 ); | |
function mx_add_cod_fee( $cart ) { | |
if ( is_admin() && ! defined( 'DOING_AJAX' ) ) | |
return; | |
$your_payment_id = 'cod'; // Metoda plaćanja | |
$fee_amount = 6; // Naknada | |
$chosen_payment_method_id = WC()->session->get( 'chosen_payment_method' ); | |
if ( $chosen_payment_method_id == $your_payment_id ) { | |
$fee_text = __( "Troškovi plaćanja pouzećem", "woocommerce" ); |
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
function admin_email_subject_with_product_names( $subject, $order ) { | |
$products_names = array(); | |
foreach ( $order->get_items() as $item ) { | |
$products_names[] = $item->get_name(); | |
} | |
return sprintf( '[%s] Nova narudžba kupca (#%s) - %s', | |
wp_specialchars_decode(get_option('blogname'), ENT_QUOTES), | |
$order->get_id(), |
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_action( 'woocommerce_single_product_summary', 'mx_price_per_installments_w_fee', 11 ); | |
function mx_price_per_installments_w_fee() { | |
global $product; | |
$price = $product->get_price(); | |
$threeinstallments = 3; | |
$sixinstallments = 6; | |
$twelveinstallments = 12; | |
$fee = (3.5/100) * $price; |
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_action( 'woocommerce_single_product_summary', 'mx_price_per_installments', 11 ); | |
function mx_price_per_installments() { | |
global $product; | |
$price = $product->get_price(); | |
$threeinstallments = 3; | |
$sixinstallments = 6; | |
$twelveinstallments = 12; |
NewerOlder