Skip to content

Instantly share code, notes, and snippets.

krokedilgists

Block or report user

Report or block krokedilgists

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@krokedilgists
krokedilgists / wc-kco-display-iframe-on-free-orders.php
Created Aug 7, 2019
Code example to show how to change a filter to display Klarna Checkout even on a free order.
View wc-kco-display-iframe-on-free-orders.php
/**
* Use together with Klarna Checkout for WooCommerce (v3 platform)
* https://wordpress.org/plugins/klarna-checkout-for-woocommerce/
*
* Filter to change if you want the Klarna Checkout iFrame to display on free orders or not.
* For example after a coupon has been used.
*/
add_filter( 'kco_check_if_needs_payment', 'kco_change_check_if_needs_payment' );
function kco_change_check_if_needs_payment( $bool ) {
@krokedilgists
krokedilgists / gist:ae9b94475e8e7986ccca8903ec3e8aa7
Created Jul 29, 2019
Add MailChimp checkbox inside the KCO v3 checkout and save the result to the order.
View gist:ae9b94475e8e7986ccca8903ec3e8aa7
<?php
/**
* Use together with Klarna Checkout for WooCommerce & MailChimp for WooCommerce.
* https://wordpress.org/plugins/klarna-checkout-for-woocommerce/
* https://wordpress.org/plugins/mailchimp-for-woocommerce/
*
* Displays the Mailchimp mailing list checkbox inside of the Klarna iFrame.
*
* Add this code to your themes functions.php file or include it in a separate functionality plugin (https://css-tricks.com/wordpress-functionality-plugins/).
**/
@krokedilgists
krokedilgists / wc-dibs-easy-gdpr-compliance-checkbox.php
Created May 10, 2019
Display GDPR Compliance checkbox in checkout page when DIBS Easy for WooCommerce is the selected payment gateway.
View wc-dibs-easy-gdpr-compliance-checkbox.php
<?php
/**
* Use together with DIBS Easy for WooCommerce & WP GDPR Compliance.
* https://wordpress.org/plugins/dibs-easy-for-woocommerce/
* https://wordpress.org/plugins/wp-gdpr-compliance/
*
* Display GDPR Compliance checkbox in checkout page when DIBS Easy for WooCommerce is the selected payment gateway.
*
* Add this code to your themes functions.php file or include it in a separate functionality plugin (https://css-tricks.com/wordpress-functionality-plugins/).
**/
@krokedilgists
krokedilgists / wc-specter-modify-pay-type-identifier.php
Created Mar 14, 2019
Code example on how to filter Paytype identifier sent in order data to Specter. For plugin Specter for WooCommerce (https://krokedil.se/specter).
View wc-specter-modify-pay-type-identifier.php
<?php
/**
* Use together with Specter for WooCommerce plugin (https://krokedil.se/specter).
*
* Filter hook wc_specter_pay_type_identifier
* Modify payTypeIdentifier sent to Specter on new order submission.
* For default/already supported paytypes see https://docs.krokedil.com/article/213-specter-introduction#h-H2_11.
*
* Add this code to your themes functions.php file or include it in a separate functionality plugin (https://css-tricks.com/wordpress-functionality-plugins/).
**/
@krokedilgists
krokedilgists / wc-kco-display-germanized-legal-field-in-checkout.php
Last active Feb 13, 2019
Display Germanized legal checkbox in checkout page when Klarna Checkout for WooCommerce is the selected payment gateway.
View wc-kco-display-germanized-legal-field-in-checkout.php
@krokedilgists
krokedilgists / wc-specter-custom-shipping-via-label.php
Created Nov 26, 2018
Code example on how to filter "Shipping via" label sent in order data to Specter. For plugin Specter for WooCommerce (https://krokedil.se/specter).
View wc-specter-custom-shipping-via-label.php
<?php
/**
* Use together with Specter for WooCommerce plugin (https://krokedil.se/specter).
*
* Filter hook wc_specter_shipping_via_label
* Change "Shipping via" label sent in order data to Specter.
*
* Add this code to your themes functions.php file or include it in a separate functionality plugin (https://css-tricks.com/wordpress-functionality-plugins/).
**/
add_filter('wc_specter_shipping_via_label', 'my_wc_specter_shipping_via_label', 10, 2);
@krokedilgists
krokedilgists / wc-collector-two-column.css
Created Nov 21, 2018
CSS for making a two column layout with Collector Checkout for WooCommerce
View wc-collector-two-column.css
@media only screen and (min-width: 769px) {
#collector-order-review {
float: left;
width: 40%;
box-sizing: border-box;
}
#collector-iframe {
float: right;
width: 60%;
box-sizing: border-box;
@krokedilgists
krokedilgists / wc-custom-checkout-field.php
Last active May 13, 2019
Add a custom checkout field to WooCommerce. This field is then displayed in the checkout page
View wc-custom-checkout-field.php
/**
* More information about custom checkout fields: https://docs.woocommerce.com/document/tutorial-customising-checkout-fields-using-actions-and-filters
*
* Add the custom field to the checkout
*/
add_action( 'woocommerce_after_order_notes', 'my_custom_checkout_field' );
function my_custom_checkout_field( $checkout ) {
woocommerce_form_field(
@krokedilgists
krokedilgists / wc-afterpay-nordics-filter-failed-capture-status.php
Created Oct 2, 2018
Code example on how to change the WooCommerce order status if an AfterPay capture request fails. Should be used together with AfterPay Nordics for WooCommerce (https://wordpress.org/plugins/afterpay-nordics-for-woocommerce/).
View wc-afterpay-nordics-filter-failed-capture-status.php
<?php
/**
* Change the WooCommerce order status when an AfterPay capture request fails.
* Default failed capture status is processing (since that is usually the order status that the order had before changing to Completed).
*/
add_filter('afterpay_failed_capture_status', 'my_afterpay_failed_capture_status', 10, 2 );
function my_afterpay_failed_capture_status( $status, $order_id ) {
return 'on-hold';
}
@krokedilgists
krokedilgists / wc-specter-custom-shipping-sku.php
Created Aug 15, 2018
Code example on how to filter Shipping SKU sent in order data to Specter. For plugin Specter for WooCommerce (https://krokedil.se/specter).
View wc-specter-custom-shipping-sku.php
<?php
/**
* Use together with Specter for WooCommerce plugin (https://krokedil.se/specter).
*
* Filter hook wc_specter_formatted_shipping_sku_shipping_id
* Change shipping SKU sent in order data to Specter.
* {SHIPPING_ID} must be entered as dynamic variable in "Shipping SKU" settings field in Specter plugin settings.
*
* Add this code to your themes functions.php file or include it in a separate functionality plugin (https://css-tricks.com/wordpress-functionality-plugins/).
**/
You can’t perform that action at this time.