Skip to content

Instantly share code, notes, and snippets.

Marco Almeida webdados

Block or report user

Report or block webdados

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
@webdados
webdados / shop_as_client_allow_checkout.php
Created Jul 18, 2019
Shop as Client - Allow other user roles to use the functionality (Shop managers and Administrators already have the ability to do so)
View shop_as_client_allow_checkout.php
<?php
add_filter( 'shop_as_client_allow_checkout', function() {
return current_user_can( 'whatever_role' );
} );
@webdados
webdados / woocommerce_checkout_fields.php
Created Jul 8, 2019
Manipulate VAT field position on Invoicing with InoiceXpress for WooCommerce
View woocommerce_checkout_fields.php
<?php
add_filter( 'woocommerce_checkout_fields', 'my_woocommerce_checkout_fields', 60 );
function my_woocommerce_checkout_fields( $fields ) {
if ( isset( $fields['billing']['billing_VAT_code'] ) ) {
$fields['billing']['billing_VAT_code']['class'] = array( 'form-row-first' ); //Or form-row-last
$fields['billing']['billing_VAT_code']['clear'] = true; //Or false if we use form-row-last
$fields['billing']['billing_VAT_code']['priority'] = 120; //120 is the default position, change this to move it up or down on the form
}
return $fields;
}
@webdados
webdados / woocommerce_portugal_address_format_include_state.php
Created Jun 3, 2019
Add "distrito" to the Portuguese address format while using the "Portugal States (Distritos) for WooCommerce" plugin
View woocommerce_portugal_address_format_include_state.php
<?php
//Add to your (child-)theme functions.php file
add_filter( 'woocommerce_portugal_address_format_include_state', '__return_true' );
@webdados
webdados / invoicexpress_woocommerce_data_obs_payment_method.php
Last active May 14, 2019
Payment method on InvoiceXpress document observations
View invoicexpress_woocommerce_data_obs_payment_method.php
<?php
// This code snippet is to be used with the "Invoicing with InvoiceXpress for WooCommerce" plugin - https://invoicexpress-woocommerce.com/
$types = array(
'invoice',
'simplified_invoice',
'invoice_receipt',
'credit_note',
'quote',
@webdados
webdados / shop_as_client_default_shop_as_client.php
Last active Apr 25, 2019
"no" as default for Shop as client on "Shop as client" plugin
View shop_as_client_default_shop_as_client.php
<?php
add_filter( 'shop_as_client_default_shop_as_client', function( $option ) {
return 'no';
});
@webdados
webdados / shop_as_client_default_create_user.php
Created Apr 25, 2019
"yes" as default for Create user on "Shop as client" plugin
View shop_as_client_default_create_user.php
<?php
add_filter( 'shop_as_client_default_create_user', function( $option ) {
return 'yes';
});
@webdados
webdados / mbway_ifthen_webservice_desc.php
Last active Apr 20, 2019
ifthen mbway use order number formatted instead of order id
View mbway_ifthen_webservice_desc.php
<?php
add_filter( 'mbway_ifthen_webservice_desc', function( $desc, $order_id ) {
$order = wc_get_order( $order_id );
return sprintf( '%s %s', get_bloginfo( 'name' ), $order->get_meta( '_order_number_formatted' ) );
}, 10, 2);
@webdados
webdados / multibanco_ifthen_valid_callback_pending_status.php
Created Apr 5, 2019
Allowed pending status for ifthenpay's Multibanco and MB Way callbacks
View multibanco_ifthen_valid_callback_pending_status.php
<?php
add_filter( 'multibanco_ifthen_valid_callback_pending_status', 'ifthen_valid_callback_pending_status' );
add_filter( 'mbway_ifthen_valid_callback_pending_status', 'ifthen_valid_callback_pending_status' );
function ifthen_valid_callback_pending_status( $status ) {
$status[] = 'wc-on-hold'; //Add "wc-on-hold"
$status[] = 'wc-pending'; //Add "wc-pending"
return $status;
}
@webdados
webdados / billing_VAT_code.php
Created Apr 2, 2019
Change “Invoicing with InvoiceXpress for WooCommerce” VAT field label
View billing_VAT_code.php
<?php
add_filter( 'woocommerce_checkout_fields', 'my_woocommerce_checkout_fields', 60 );
function my_woocommerce_checkout_fields( $fields ) {
if ( isset( $fields['billing']['billing_VAT_code'] ) ) {
$fields['billing']['billing_VAT_code']['label'] = 'My own label'; //If you are running a multilingual website you should be using __() so it can be translated
}
return $fields;
}
@webdados
webdados / invoicexpress_woocommerce_document_item_title_with_meta.php
Created Mar 16, 2019
Remove metas from WooCommerce Orders item titles on InvoiceXpress documents
View invoicexpress_woocommerce_document_item_title_with_meta.php
<?php
//Add this to your (child-)theme functions.php file
add_filter( 'invoicexpress_woocommerce_document_item_title_with_meta', '__return_false' );
You can’t perform that action at this time.