Read a product-specific terms URL

The modern product-specific terms module exposes a convenience helper for the first policy and a helper for the complete configured list:

pom_tweaks_get_terms_url( $product ): string
pom_tweaks_get_terms_policies( $product ): array

Enable it under Settings → POM Tweaks → E-Commerce → Accounts & privacy → Product specific Terms & Conditions before using the helper.

Accepted input

$product can be:

  • a WC_Product object;
  • a numeric WooCommerce product or variation ID.

The scalar helper returns the first policy URL, or an empty string for invalid input, a missing product, or a product without policies. The list helper returns an array of url and pdf_url pairs, or an empty array. For a variation without its own value, the helper falls back to the parent product policy.

Use the helper safely

$terms_url = function_exists( 'pom_tweaks_get_terms_url' )
    ? pom_tweaks_get_terms_url( $product )
    : '';

if ( $terms_url !== '' ) {
    printf(
        '<a href="%s">%s</a>',
        esc_url( $terms_url ),
        esc_html__( 'Product terms', 'your-text-domain' )
    );
}

The returned value is the saved, validated policy URL. Escape it for the final output context. Do not use helper availability as evidence that a customer accepted the policy; checkout acceptance is recorded separately on the order.

Complete policy lists and PDF providers

pom_tweaks_get_terms_policies() preserves the saved row order and variation inheritance. Treat pdf_url as server-side configuration; do not publish it in storefront markup or unauthenticated APIs. The scalar helper returns the first configured URL.

A server-side provider can implement pom_tweaks_resolve_terms_pdf with three arguments: the previous result, the configured absolute PDF URL, and the policy context. Existing two-argument callbacks remain supported. Return null when the provider does not own the URL, an array containing the binary bytes value when it resolves the document, or WP_Error when an owned address is unavailable or unauthorized. Providers must enforce their own source scope and document eligibility. An error prevents fallback to public HTTP retrieval.

General policies include scope: general, page_id, and blog_id. Use them to reject an address that resolves to a different page from the accepted general terms. Product policies do not require those fields.

For automatic general PDF selection, implement pom_tweaks_general_terms_pdf_url with three arguments: the previous URL, the effective WooCommerce terms page ID, and its public permalink. Return an absolute HTTP(S) PDF address only for an owned, supported page; preserve the incoming value otherwise. The hook runs when general capture is enabled and its manual URL is empty. This is address resolution only: the ordinary PDF provider must still verify document readiness when capturing acceptance.

The consumer verifies the PDF file header, total size, and captured SHA-256; it does not validate a digital signature. No HTTP endpoint or public authorization is implied by this filter. Public PDF URLs use WordPress's safe HTTP API when no provider claims them. Only trusted server code may register providers.

Verification

Test a simple product with a policy, a product without one, a variation that inherits its parent policy, an invalid ID, and the disabled-module state.

See Require product-specific terms at checkout for configuration and recorded checkout evidence.