1. Home
  2. Docs
  3. Doc of Product XML Feeds ...
  4. ShortCode
  5. Shortcodes for generating XML fields

Shortcodes for generating XML fields

XML Fields for WooCommerce – Shortcodes Guide

The list of shortcodes available for generating XML fields in WooCommerce, allowing you to dynamically display product information, pricing, dimensions, taxonomies, and more. The shortcodes are categorized for easy reference, covering dimensions, taxonomies, pricing, and other relevant fields.


Dimensions

  1. [alg_product_weight]
    • Description: Displays the product’s weight.
    • Example Usage: [alg_product_weight]
  2. [alg_product_length]
    • Description: Displays the product’s length.
    • Attributes:
      • to_unit: Converts the result to specified units (e.g., cm, inches).
      • round: Rounds the final result.
      • precision: Sets rounding precision.
    • Example Usage: [alg_product_length to_unit="cm" round="yes" precision="2"]
  3. [alg_product_width]
    • Description: Displays the product’s width.
    • Attributes: Same as for [alg_product_length].
    • Example Usage: [alg_product_width]
  4. [alg_product_height]
    • Description: Displays the product’s height.
    • Attributes: Same as for [alg_product_length].
    • Example Usage: [alg_product_height]
  5. [alg_product_dimensions]
    • Description: Displays the product’s dimensions (length x width x height).
    • Example Usage: [alg_product_dimensions]

Taxonomies

  1. [alg_product_tags]
    • Description: Displays the product’s tags.
    • Attributes:
      • add_links: Adds links to the tags page.
      • sep: Separator between tags.
    • Example Usage: [alg_product_tags add_links="no" sep=", "]
  2. [alg_product_categories]
    • Description: Displays the product’s categories.
    • Example Usage: [alg_product_categories]
  3. [alg_product_categories_names]
    • Description: Displays the product’s category names.
    • Attributes:
      • sep: Separator between category names.
    • Example Usage: [alg_product_categories_names sep=", "]
  4. [alg_product_categories_urls]
    • Description: Displays the product’s category URLs.
    • Attributes: Same as for [alg_product_categories_names].
    • Example Usage: [alg_product_categories_urls sep=", "]
  5. [alg_product_terms]
    • Description: Displays the product’s taxonomy terms.
    • Attributes:
      • taxonomy: The name of the taxonomy to display (e.g., brand).
      • sep: Separator between terms.
      • orderby: Sort terms by name, parent_id, term_id, or hierarchy.
    • Example Usage: [alg_product_terms taxonomy="brand" sep=", " orderby="name"]

Taxes

  1. [alg_product_tax_class]
    • Description: Displays the product’s tax class.
    • Example Usage: [alg_product_tax_class]

Shipping

  1. [alg_product_shipping_class]
    • Description: Displays the product’s shipping class.
    • Example Usage: [alg_product_shipping_class on_empty="Standard"]

Stock

  1. [alg_product_stock_quantity]
    • Description: Displays the product’s stock quantity.
    • Example Usage: [alg_product_stock_quantity]
  2. [alg_product_stock_availability]
    • Description: Displays the product’s stock availability status.
    • Example Usage: [alg_product_stock_availability]

Price & Currency

  1. [alg_shop_currency]
    • Description: Displays the shop’s currency code.
    • Example Usage: [alg_shop_currency]
  2. [alg_product_price]
    • Description: Displays the product’s price.
    • Attributes:
      • multiply_by: Multiplies the price by a specified value.
      • hide_currency: Displays price without currency symbol.
    • Example Usage: [alg_product_price multiply_by="1.25" hide_currency="no"]
  3. [alg_product_sale_price]
    • Description: Displays the product’s sale price.
    • Attributes: Same as for [alg_product_price].
    • Example Usage: [alg_product_sale_price]
  4. [alg_product_regular_price]
    • Description: Displays the product’s regular price.
    • Attributes: Same as for [alg_product_price].
    • Example Usage: [alg_product_regular_price]
  5. [alg_product_price_including_tax]
    • Description: Displays the product’s price including tax.
    • Attributes: Same as for [alg_product_price].
    • Example Usage: [alg_product_price_including_tax]
  6. [alg_product_price_excluding_tax]
    • Description: Displays the product’s price excluding tax.
    • Attributes: Same as for [alg_product_price].
    • Example Usage: [alg_product_price_excluding_tax]
  7. [alg_product_you_save]
    • Description: Displays the amount saved (regular price minus sale price).
    • Attributes:
      • hide_if_zero: Hides output if savings amount is zero.
      • hide_currency: Displays savings amount without currency symbol.
    • Example Usage: [alg_product_you_save]
  8. [alg_product_you_save_percent]
    • Description: Displays the percentage saved.
    • Attributes: Same as for [alg_product_you_save].
    • Example Usage: [alg_product_you_save_percent]

Title & Descriptions

  1. [alg_product_title]
    • Description: Displays the product’s title.
    • Example Usage: [alg_product_title]
  2. [alg_product_excerpt]
    • Description: Displays the product’s excerpt.
    • Attributes:
      • length: Limits the excerpt length.
    • Example Usage: [alg_product_excerpt length="10"]
  3. [alg_product_short_description]
    • Description: Displays the product’s short description.
    • Attributes: Same as for [alg_product_excerpt].
    • Example Usage: [alg_product_short_description length="10"]
  4. [alg_product_description]
    • Description: Displays the product’s full description.
    • Example Usage: [alg_product_description]
  5. [alg_product_formatted_name]
    • Description: Displays the product’s formatted name.
    • Example Usage: [alg_product_formatted_name]
  6. [alg_product_name]
    • Description: Displays the product’s name.
    • Example Usage: [alg_product_name]

Images

  1. [alg_product_image_url]
    • Description: Displays the product’s main image URL.
    • Attributes:
      • image_size: Specifies the image size to retrieve (e.g., full, thumbnail).
    • Example Usage: [alg_product_image_url image_size="full"]
  2. [alg_product_gallery_image_url]
    • Description: Displays the product’s gallery image URLs.
    • Attributes:
      • image_nr: Specifies the number of the gallery image.
    • Example Usage: [alg_product_gallery_image_url image_nr="1"]

Custom Fields

  1. [alg_product_meta]
    • Description: Displays product meta data.
    • Attributes:
      • name: The meta key to retrieve.
    • Example Usage: [alg_product_meta name="your_custom_field_name"]
  2. [alg_product_custom_field]
    • Description: Displays custom field data for the product.
    • Attributes: Same as for [alg_product_meta].
    • Example Usage: [alg_product_custom_field name="your_custom_field_name"]

Attributes

  1. [alg_product_list_attributes]
    • Description: Displays a list of the product’s attributes.
    • Example Usage: [alg_product_list_attributes]
  2. [alg_product_list_attribute]
    • Description: Displays a single product attribute.
    • Attributes:
      • name: Name of the attribute to display.
    • Example Usage: [alg_product_list_attribute name="size"]

Formatting

  1. [alg_format_date]
    • Description: Formats a value as a date.
    • Attributes:
      • format: Date format (e.g., Y-m-d).
    • Example Usage: [alg_format_date format="m-d-Y"][alg_product_meta name="your_custom_field_name"][/alg_format_date]
  2. [alg_format_number]
    • Description: Formats a value as a number.
    • Attributes:
      • decimals: Number of decimal points.
      • dec_point: Decimal point separator.
      • thousands_sep: Thousands separator.
    • Example Usage: [alg_format_number decimals="2"][alg_product_meta name="your_custom_field_name"][/alg_format_number]
  3. [alg_to_timestamp]
    • Description: Converts a date/time string to a timestamp.
    • Example Usage: [alg_to_timestamp][alg_product_meta name="your_custom_field_name"][/alg_to_timestamp]

Variations

  1. [alg_product_available_variations]
    • Description: Displays available product variations.
    • Attributes:
      • sep: Separator for variation attributes.
      • sep2: Separator for variation attributes and price.
      • sep3: Separator for variations.
    • Example Usage: [alg_product_available_variations sep=", " sep2=": " sep3=" | "]

General

  1. [alg_current_datetime]
    • Description: Displays the current date and time.
    • Attributes:
      • datetime_format: Date and time format.
    • Example Usage: [alg_current_datetime datetime_format="Y-m-d H:i:s"]
  2. [alg_product_id]
    • Description: Displays the product’s ID.
    • Example Usage: [alg_product_id]
  3. [alg_product_type]
    • Description: Displays the product’s type (e.g., simple, variable).
    • Example Usage: [alg_product_type]
  4. [alg_product_url]
    • Description: Displays the product’s URL.
    • Example Usage: [alg_product_url]
  5. [alg_product_sku]
    • Description: Displays the product’s SKU.
    • Example Usage: [alg_product_sku]
  6. [alg_product_total_sales]
    • Description: Displays the total sales number for the product.
    • Attributes:
      • hide_if_zero: Hides output if the sales number is zero.
      • offset: Adds to the final sales number.
    • Example Usage: [alg_product_total_sales]
  7. [alg_product_average_rating]
    • Description: Displays the product’s average rating.
    • Example Usage: [alg_product_average_rating]
  8. [alg_product_time_since_last_sale]
    • Description: Displays the time since the product’s last sale.
    • Attributes:
      • order_status: Order status to count as a sale.
      • days_to_cover: Maximum number of days to check.
    • Example Usage: [alg_product_time_since_last_sale order_status="wc-completed" days_to_cover="90"]
  9. [alg_product_function]
    • Description: Displays the result of any product function.
    • Attributes:
      • function: The name of the function to call.
    • Example Usage: [alg_product_function function="get_description"]

These shortcodes offer extensive flexibility in customizing and displaying WooCommerce product information in XML fields. By leveraging these shortcodes, you can ensure that your product data is presented accurately and dynamically, tailored to your store’s needs.