Facebook Open Graph Image (og:image) Size

  • The minimum allowed image(og:image) dimension is 200 x 200 pixels.
  • The size of the image file must not exceed 8 MB.
  • Use images that are at least 1200 x 630 pixels for the best display on high resolution devices. At the minimum, you should use images that are 600 x 315 pixels to display link page posts with larger images.
  • If your image is smaller than 600 x 315 px, it will still display in the link page post, but the size will be much smaller.
  • Try to keep your images as close to 1.91:1 aspect ratio as possible to display the full image in News Feed without any cropping.
    Facebook crawler only accepts gzip and deflate encodings, so make sure your server uses the right encoding.

WooCommerce Customising checkout fields using actions and filters

Adding custom shipping and billing fields in checkout page

// Hook in
add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );

// Our hooked in function - $fields is passed via the filter!
function custom_override_checkout_fields( $fields ) {
     $fields['shipping']['shipping_phone'] = array(
        'label'     => __('Phone', 'woocommerce'),
    'placeholder'   => _x('Phone', 'placeholder', 'woocommerce'),
    'required'  => false,
    'class'     => array('form-row-wide'),
    'clear'     => true
     );

     return $fields;
}

/**
 * Display field value on the order edit page
 */
 
add_action( 'woocommerce_admin_order_data_after_shipping_address', 'my_custom_checkout_field_display_admin_order_meta', 10, 1 );

function my_custom_checkout_field_display_admin_order_meta($order){
    echo '<p><strong>'.__('Phone From Checkout Form').':</strong> ' . get_post_meta( $order->get_id(), '_shipping_phone', true ) . '</p>';
}

WooCommerce Stripe Tips

Can I hide the Payment Request button on the single Product page?

You can remove the Payment Request button from the Product page with this filter: add_filter( 'wc_stripe_hide_payment_request_on_product_page', '__return_true' );

Can I hide the Payment Request button on the Cart page?

Yes, you would need to remove the actions:

remove_action( ‘woocommerce_proceed_to_checkout’, array( WC_Stripe_Payment_Request::instance(), ‘display_payment_request_button_html’ ), 1 );

remove_action( ‘woocommerce_proceed_to_checkout’, array( WC_Stripe_Payment_Request::instance(), ‘display_payment_request_button_separator_html’ ), 2 );

Can I show the Payment Request button on the Checkout page?

Yes, although the Payment Button has been removed for clarity on the Checkout Page, a filter has been added to allow you to show this again: add_filter( 'wc_stripe_show_payment_request_on_checkout', '__return_true' );

WooCommerce Stripe Hooks (Actions/Filters)

Hook name (parameters)

Action Hooks

  • wc_gateway_stripe_process_response ($stripe_response, $order) – The response we get back after calling a charge request to Stripe.
  • woocommerce_credit_card_form_start ($gateway_id) – Before showing the credit card form.
  • woocommerce_credit_card_form_end ($gateway_id) – After showing the credit card form.
  • wc_stripe_checkout_receipt_page_before_form – Before showing the Stripe Checkout (Popup modal) form.
  • wc_stripe_checkout_receipt_page_after_form – After showing the Stripe Checkout (Popup modal) form.
  • wc_stripe_checkout_receipt_page_before_form_submit – Before showing the Stripe Checkout (Popup modal) form submit.
  • wc_stripe_checkout_receipt_page_after_form_submit – After showing the Stripe Checkout (Popup modal) form submit.
  • wc_stripe_checkout_return_handler ($order) – Stripe Checkout (Popup modal) after submitting the payment in the popup.
  • wc_gateway_stripe_process_payment ($stripe_response, $order) – The response we get back after calling a charge request to Stripe but before processing the actual response.
  • wc_gateway_stripe_process_payment_error ($error, $order) – Called when an error occurs during the process payment event.
  • woocommerce_stripe_add_customer ($args, $response) – Called after creating a Stripe customer.
  • woocommerce_stripe_add_source ($stripe_customer_id, $wc_token, $response, $source_id) – Called after creating/attaching a source to a customer.
  • wc_stripe_delete_source ($stripe_customer_id, $response) – Called after deleting a source from customer.
  • wc_stripe_set_default_source ($stripe_customer_id, $response) – Called after setting a default source to a customer.
  • wc_gateway_stripe_process_redirect_payment ($response, $order) – Called after a redirect payment process.
  • wc_gateway_stripe_process_redirect_payment_error ($error, $order) – Called after a failed redirect payment process.
  • woocommerce_stripe_process_manual_capture ($order, $result) – Called after a manual capture of a charge within admin order.
  • woocommerce_stripe_process_manual_cancel ($order) – Called after a cancel of the order that is authorized and not yet captured.
  • wc_gateway_stripe_process_webhook_payment ($response, $order) – Called after a webhook payment process.
  • wc_gateway_stripe_process_webhook_payment_error ($order, $notification, *$e) – Called after a webhook payment process error.

Filter Hooks

  • wc_stripe_save_to_account_text ($text) – Text that shows to customers next to the save payment information checkbox.
  • wc_stripe_payment_icons ($icons_array) – Icons that show next to each payment method.
  • wc_stripe_send_stripe_receipt *boolean* – Whether to send a receipt via Stripe.
  • wc_stripe_payment_metadata ($metadata, $order, $prepared_source) – Metadata that gets passed during a payment request.
  • wc_stripe_generate_payment_request ($post_data, $order, $prepared_source) – Post data that gets passed during a payment request.
  • wc_stripe_owner_details ($details, $order) – The owner details of an order.
  • wc_stripe_require_3ds ($require_3ds, $source_object, $three_d_secure) – Override if 3DS should be required.
  • wc_stripe_3ds_source ($post_data, $order) – Post data when creating 3DS source.
  • wc_stripe_force_save_source ($force_save_source, $customer) – Override force save customer.
  • wc_stripe_use_default_customer_source ($use_default) – Whether to use default customer source if source not found.
  • wc_stripe_refund_request ($request, $order) – Request parameters when refund is requested.
  • wc_stripe_PAYMENT_METHOD_settings ($settings)</strong – Admin settings for payment method.
  • wc_stripe_checkout_verify_zip *boolean* – Whether to verify zip when using Stripe Checkout (Popup modal).
  • wc_stripe_checkout_require_billing_address *boolean* – Whether to require billing address when using Stripe Checkout (Popup modal).
  • wc_stripe_checkout_require_shipping_address *boolean* – Whether to require shipping address when using Stripe Checkout (Popup modal).
  • wc_stripe_checkout_locale ($locale) – Sets the locale for the Stripe Checkout (Popup modal).
  • wc_stripe_allow_remember_me *boolean* – Whether to show the remember me option for Stripe Checkout (Popup modal).
  • wc_stripe_description ($description, $payment_method_id) – Override the description of credit card payments.
  • wc_stripe_display_save_payment_method_checkbox *boolean* – Whether to show the save payment method checkbox.
  • wc_stripe_sepa_mandate_notification ($method) – The method to use to inform customer of the SEPA mandate.
  • wc_stripe_allow_prepaid_card *boolean* – Whether to allow prepaid credit card to be used.
  • wc_stripe_elements_options – Additional options to manipulate Stripe elements.
  • wc_stripe_elements_styling – Additional options to manipulate the Stripe elements styling.
  • wc_stripe_elements_classes – Additional options to add classes to the Stripe elements.
  • wc_stripe_params ($params) – Localized JS key/value pair.
  • wc_stripe_payment_request_params ($params) – Localized JS key/value pair.
  • wc_stripe_checkout_label – Label that shows up on the Stripe Checkout (Popup modal).
  • wc_stripe_hide_display_order_fee ($bool, $order_id) – Whether to hide the display order fee in orders view.
  • wc_stripe_hide_display_order_payout ($bool, $order_id) – Whether to hide the display order payout in orders view.
  • woocommerce_stripe_request_headers ($headers_args) – Headers parameters for cURL requests.
  • wc_stripe_idempotency_key ($key_string, $request) – The string for the idempotency key on request.
  • woocommerce_stripe_request_body ($request, $api) – The request body to pass when doing a request
  • wc_stripe_customer_metadata ($metadata, $user) – The meta data used when creating a customer.
  • wc_stripe_create_customer_args ($args) – The arguments used when creating a customer.
  • wc_stripe_localized_messages ($localized_messages) – The messages used from Stripe responses.
  • wc_stripe_logging ($bool, $message) – Whether to log a specific message when logging is enabled.
  • wc_stripe_webhook_review_change_order_status ($bool, $order, $notification) – Whether to change the order status when order review event happens.
  • wc_stripe_PAYMENT_METHOD_supported_currencies ($currencies) – The supported currencies for that specific payment method.
  • wc_stripe_payment_request_total_label_suffix ($suffix) – Label suffix to use when Payment Request is engaged.
  • wc_stripe_payment_request_total_label ($label) – The total label to use when Payment Request is engaged.
  • wc_stripe_payment_request_supported_types ($types) – The product types Payment Request supports.
  • wc_stripe_hide_payment_request_on_product_page *boolean* – Whether to hide Payment Request button on product detail page.
  • wc_stripe_show_payment_request_on_checkout *boolean* – Whether to show Payment Request button on checkout page.
  • wc_stripe_payment_request_hide_itemization *boolean* – Whether to show itemizations when using Payment Request.

WooCommerce Product CSV Importer and Exporter

Create your CSV

Guidelines

General

  • CSVs should be in UTF-8 format.
  • Dates should be defined for the store’s local timezone.
  • Use 1 or 0 in your CSV, if importing a Boolean value (true or false)
  • Multiple values in a field get separated with commas.
  • Wrapping values in quotes allows you to insert a comma.
  • Prefix the id with id: if referencing an existing product ID. No prefix is needed if referencing an SKU. For example: id:100SKU101
  • Custom meta is supported/imported but only plain text – no support for JSON or Serialized data.
  • Taxonomy term hierarchy is denoted with >, terms are separated with commas.
  • Draft products are not exported, only published and privately published products.

Sample Download:  CSV file with sample data from GitHub and replace it.

WooCommerce Variable Product

Adding a variable product

Step 1. Set the product type

To add a variable product, create a new product or edit an existing one.

  1. Go toWooCommerce > Products.
  2. Select the Add Product button or Edit an existing product. The Product Data displays.
  3. Select Variable product from the Product Data dropdown.

Step 2. Add attributes to use for variations

In the Attributes section, add attributes before creating variations —

To use a global attribute:

  1. Select one from the dropdown and Add.
  2. Choose Select all to add all attributes to the variable product (if applicable).
  3. Tick the Used for variations checkbox to tell WooCommerce it’s for your variations.

Step 3. Add variations

WooCommerce Available Product Attributes Shortcode

Display Product Attributes

  • limit – The number of products to display. Defaults to and -1 (display all)  when listing products, and -1 (display all) for categories.
  • columns – The number of columns to display. Defaults to 4.
  • paginate – Toggles pagination on. Use in conjunction with limit. Defaults to false set to true to paginate .
  • orderby – Sorts the products displayed by the entered option. One or more options can be passed by adding both slugs with a space between them. Available options are:
    • date – The date the product was published.
    • id – The post ID of the product.
    • menu_order – The Menu Order, if set (lower numbers display first).
    • popularity – The number of purchases.
    • rand – Randomly order the products on page load (may not work with sites that use caching, as it could save a specific order).
    • rating – The average product rating.
    • title – The product title. This is the default orderby mode.
  • skus – Comma separated list of product SKUs.
  • category – Comma separated list of category slugs.
  • order – States whether the product ordering is ascending (ASC) or descending (DESC), using the method set in orderby. Defaults to ASC.
  • class – Adds an HTML wrapper class so you can modify the specific output with custom CSS.
  • on_sale – Retrieve on sale products. Not to be used in conjunction with best_sellingor top_rated.
  • best_selling – Retrieve best selling products. Not to be used in conjunction with on_sale or top_rated.
  • top_rated – Retrieve top rated products. Not to be used in conjunction with on_saleor best_selling.

Content Product Attributes

  • attribute – Retrieves products using the specified attribute slug.
  • terms – Comma separated list of attribute terms to be used with attribute.
  • terms_operator – Operator to compare attribute terms. Available options are:
    • AND – Will display products from all of the chosen attributes.
    • IN – Will display products with the chosen attribute. This is the default terms_operator value.
    • NOT IN – Will display products that are not in the chosen attributes.
  • visibility – Will display products based on the selected visibility. Available options are:
    • visible – Products visibile on shop and search results. This is the default visibility option.
    • catalog – Products visible on the shop only, but not search results.
    • search – Products visible in search results only, but not on the shop.
    • hidden – Products that are hidden from both shop and search, accessible only by direct URL.
    • featured – Products that are marked as Featured Products.
  • category – Retries products using the specified category slug.
  • cat_operator – Operator to compare category terms. Available options are:
    • AND – Will display products that belong in all of the chosen categories.
    • IN – Will display products within the chosen category. This is the default cat_operator value.
    • NOT IN – Will display products that are not in the chosen category.
  • ids – Will display products based off of a comma separated list of Post IDs.
  • skus – Will display products based off of a comma separated list of SKUs.