This file contains 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
//https://stackoverflow.com/questions/28576667/get-cart-item-name-quantity-all-details-woocommerce | |
function xnagyg_woocommerce_add_to_cart_validation($passed,$product_id,$quantity) { | |
//nem megy if (empty( $_GET['add-to-cart-only-once'] )){ | |
// return true; //nincs az url-ben jel, hogy figyeljük | |
// } | |
global $woocommerce; | |
$items = $woocommerce->cart->get_cart(); | |
foreach($items as $item => $values) | |
{ |
This file contains 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
//Kosár darabszám változás után automatikus újraszámolás legyen | |
//https://gist.github.com/mikaelz/f41e29c6a99a595602e4 | |
function xnagyg_cart_update_qty_script() { | |
if (is_cart()) : | |
?> | |
<script> | |
jQuery('div.woocommerce').on('change', '.qty', function(){ | |
jQuery("[name='update_cart']").removeAttr('disabled'); | |
jQuery("[name='update_cart']").trigger("click"); | |
}); |
This file contains 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
//Vásárláskor az egyedi oldalra irányítson át, order és key paraméterekbe tenni az információt. | |
function xnagyg_thankyouredirect($order_id) { | |
$order_key = wc_clean( $_GET['key'] ); | |
$redirect = get_permalink( 338 ); //This is the Custom Shop Thanks page id //TODO: admin option | |
$redirect = add_query_arg( array( | |
'order' => $order_id, | |
'key' => $order_key, | |
), $redirect ); |
This file contains 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
//Usage: [woothankyouform default='Hibás megrendelésszám!'] | |
function xnagyg_woocommerce_thankyou( $atts ) { | |
extract( shortcode_atts( array( | |
'default' => '', | |
), $atts ) ); | |
//Must remove action because of infinite redirect loop. checkout/thankyou.php template would call it again | |
remove_action('woocommerce_thankyou','xnagyg_thankyouredirect',1); | |
// Check if the order ID exists. |
This file contains 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
//https://businessbloomer.com/woocommerce-redirect-checkout-add-cart/ alapján | |
function xnagyg_redirect_checkout_add_cart( $url ) { | |
//csak ha van add-to-cart az url-ben GET | |
if ( empty( $_GET['add-to-cart'] ) || ! is_numeric( $_GET['add-to-cart'] ) ) { | |
return false; //ne irányítson át | |
} | |
$url = get_permalink( get_option( 'woocommerce_checkout_page_id' ) ); //Pénztár oldalra menjen | |
return $url; | |
} | |