Skip to content

Instantly share code, notes, and snippets.

View kostas-artware's full-sized avatar

Konstantinos kostas-artware

View GitHub Profile
@kostas-artware
kostas-artware / functions.php
Created September 23, 2021 10:37
Add a checkbox with a fee in woocomerce checkoute page.
add_action( 'woocommerce_after_checkout_billing_form', 'add_box_option_to_checkout' );
function add_box_option_to_checkout( $checkout ) {
echo '<div id="message_fields">';
woocommerce_form_field( 'add_gift_box', array(
'type' => 'checkbox',
'class' => array('add_gift_box form-row-wide'),
'label' => __('Ilość pudełek ozdobnych - 25 PLN/szt'),
'placeholder' => __(''),
), $checkout->get_value( 'add_gift_box' ));
@kostas-artware
kostas-artware / orderby -menu order in dashboard
Last active July 19, 2021 07:49
Order query items as in admin dashboard wordpres - orderby =>
$args = array(
'post_parent' => get_the_ID(),
'post_type' => 'page',
'numberposts' => -1,
'post_status' => 'publish',
'orderby' => 'menu_order',
'order' => 'ASC'
);
@kostas-artware
kostas-artware / onhref.css
Created May 14, 2021 10:01
DISABLE HREF ON HREF - REMOVE LINK FUNCTION
.categories-links a{
pointer-events: none;
cursor: default;
}
@kostas-artware
kostas-artware / force_cart_update_checkout.php
Created April 21, 2021 10:14
woocomerce smart cod ___ force cart update __ pre select a payment option hack on checkout
function woocommerce_add_update_checkout() {
// Only on checkout page
if( ! is_checkout() ) return;
?>
<script type="text/javascript">
(function($){
$('form.checkout').on( 'change', 'input[name^="shipping_method"]', function() {
document.getElementById("payment_method_piraeusbank_gateway").checked = true;
console.log('update')
});