Zum Inhalt springen

Configuration

Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.

Swift is configured on one screen: WooCommerce → Swift Quick Buy. Every option is stored in a single array option, swift_settings, and the page shows a live preview of the button as you change the style and label. The save capability is manage_woocommerce, so shop managers, not just administrators, can edit it.

The master switch (enabled), on by default. When off, Swift adds no button, script or stylesheet to the storefront, the button CSS and the quantity script are only enqueued when the feature is enabled, so disabling Swift is a true zero-footprint disable rather than a hidden CSS toggle. The header shows a Live / Off badge that reflects this state.

The text on the button (button_text), capped at 60 characters. Leave it empty to fall back to the translatable default, Buy now. The label is a translatable string, so on a multilingual store it follows the active language. The live preview reflects whatever you type.

Two independent toggles decide where the button appears:

  • Single product page (show_on_single, on by default), rendered on the woocommerce_after_add_to_cart_button hook at priority 15.
  • Shop & archive loops (show_on_loop, off by default), rendered on woocommerce_after_shop_loop_item.

On loops the button is shown for simple, in-stock, purchasable products only. A variable product needs a variation chosen first, so it never gets a loop button. On the single page the button is also suppressed when the product is out of stock or not purchasable.

single_position is either after (default) or before. After keeps WooCommerce’s add-to-cart primary with Buy Now as the express shortcut beside it. Choosing before moves Swift’s exact render callback from the after hook to woocommerce_before_add_to_cart_button (same priority 15), so the swap is clean and order is predictable.

redirect_target is checkout (default) or cart:

  • Checkout, the product is added and the shopper is sent straight to checkout (wc_get_checkout_url()), skipping the cart page. This is the point of Swift.
  • Cart, the product is added and the shopper lands on the cart (wc_get_cart_url()) to review first.

clear_cart, on by default. When on, Swift empties the cart before adding the clicked product, so checkout shows only that item, the true “buy just this” flow. Turn it off to add to whatever is already in the cart. The clear happens server-side in the template_redirect handler, not in the browser.

respect_quantity, off by default. When on, a small vanilla script (buy-now.js, footer, no dependencies) mirrors the value of WooCommerce’s own input.qty into the Buy Now form on submit, so the shopper buys the quantity they chose. It applies to single, simple products only; loops have no quantity field, and when the option is off exactly one unit is bought. The server still floors the quantity at 1.

button_style is theme (default), solid or outline:

  • Theme default, inherits your theme’s .button styling; blends in.
  • Solid, filled with the accent colour.
  • Outline, bordered, using the accent colour.

accent_color is an optional hex value used by the solid and outline styles; it is sanitised with sanitize_hex_color, so an invalid value is dropped. Leave it empty to use Swift’s default velocity violet, #5b3df5. The accent is injected as a scoped inline style on .swift-buy-now, so it themes only Swift’s own buttons and never leaks onto the rest of the page. Theme default ignores the accent entirely.

Swift is stateless: it stores the one swift_settings option and a swift_db_version schema marker, and creates no custom tables and no product meta. Uninstalling the plugin deletes both options on every site in a network (multisite-aware), leaving your database as it was.