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-dibs-easy-icon-html.php
Last active Nov 22, 2019
Modify the icon displayed for DIBS Easy payment gateway in checkout
View wc-dibs-easy-icon-html.php
<?php
/**
* Filter hook wc_dibs_easy_icon_html
* Modify the icon displayed for DIBS Easy payment gateway in checkout.
*
* 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_dibs_easy_icon_html', 'krokedil_wc_dibs_easy_icon_html');
function krokedil_wc_dibs_easy_icon_html( $icon_html ) {
// Standard image is https://cdn.dibspayment.com/logo/checkout/combo/horiz/DIBS_checkout_kombo_horizontal_04.png.
View wc-specter-received-product-data.php
<?php
/**
* Action hook wc_specter_received_product_data
* Save custom product data received from Specter on product updates/changes in Specters system.
*/
add_action( 'wc_specter_received_product_data', 'my_custom_product_update', 10, 2 );
function my_custom_product_update( $article, $product_id ) {
// Save commodityCode.
if ( ! empty( $article['@attributes']['commodityCode'] ) ) {
@krokedilgists
krokedilgists / wc-specter-send-custom-order-internal-comment.php
Created Oct 30, 2019
Modify order internal comment sent to Specter on new order submission.
View wc-specter-send-custom-order-internal-comment.php
<?php
/**
* Filter hook wc_specter_internal_comment
* Modify order internal comment sent to Specter on new order submission.
*
**/
add_filter( 'wc_specter_internal_comment', 'my_wc_specter_internal_comment', 10, 2 );
function my_wc_specter_internal_comment( $internal_comment, $order_id ) {
@krokedilgists
krokedilgists / wc-kco-change-purchase-country.php
Created Oct 9, 2019
Sets a forced purchase country for the KCO v3 plugin.
View wc-kco-change-purchase-country.php
<?php
/**
* Filter to change the purchase country. Overwrites the WooCommerce default, and sets a forced purchase country.
* Change SE to whatever value you want, 2 letter country codes only.
*/
add_filter( 'kco_wc_api_request_args', 'kco_wc_change_purchase_country' );
/**
* Changes the purchase country.
*
@krokedilgists
krokedilgists / wc-specter-add-ean-in-product-sync.php
Created Sep 18, 2019
Example of how to add Barcode in product sync from WooCommerce to Specter.
View wc-specter-add-ean-in-product-sync.php
<?php
add_filter( 'wc_specter_send_custom_product_data', 'my_custom_product_data', 10, 3 );
function my_custom_product_data( $params, $product, $is_variation = false ) {
/**
* $params is the product data stored as an array.
* $product is the product object. Product variation object if this is a product variation.
* $is_variation is true/false depending on if this is a product variation or not.
*/
$params['barCode'] = get_post_meta( $product->get_id(), 'woocommerce-pricefiles_ean_code', true );
@krokedilgists
krokedilgists / wc-specter-trigger-order-sending.php
Last active Dec 3, 2019
Automatically trigger new orders payed with payment method jetpack_custom_gateway to be sent to Specter
View wc-specter-trigger-order-sending.php
<?php
/**
* Action hook wc_specter_send_order_to_specter
*
* Trigger action so new order payed with (manual) jetpack_custom_gateway payment gateway is sent to Specter.
**/
add_action( 'woocommerce_thankyou_jetpack_custom_gateway', 'krokedil_send_order_to_specter' );
function krokedil_send_order_to_specter( $order_id ) {
@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
Last active Dec 2, 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/).
**/
You can’t perform that action at this time.