WP Manifestindependent plugin directory
manifest / ecommerce / lsg-diagnostic-parfum

LSG Diagnostic Parfum

Plugin WordPress/WooCommerce : outil de diagnostic parfum (famille olfactive + note) avec bloc Gutenberg, shortcode et compatibilité WPML, pour lessenteursgourmandes.fr

by Lucas Troteseil · github.com/lucas-tsl/lsg-diagnostic-parfum · website

0stars
0forks

Install

No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:

wp plugin install https://github.com/lucas-tsl/lsg-diagnostic-parfum/archive/refs/heads/main.zip

A WordPress/WooCommerce plugin that adds a perfume-finder (scent family + note) diagnostic tool: a Gutenberg block for product category pages, and a [lsg_diag_parfum] shortcode for a dedicated, fully responsive, WPML-aware page.

Author: Lucas TroteseilWordPress.org profile

Features

  • Gutenberg block (custom/diag) for WooCommerce category templates — filters the existing product loop via pre_get_posts based on ?diag_parfum= / ?diag_note= query parameters.
  • Shortcode [lsg_diag_parfum] for any standalone page — renders its own responsive 2-column layout:
    • Left column: title, subtitle, the two filters, a reset button, and a live result count.
    • Right column: a loading indicator and the matching WooCommerce products grid.
  • No full page reload on the shortcode page: filtering calls the plugin's REST API and swaps only the results grid, with the URL updated via history.pushState. Falls back to a normal navigation if the request fails, and to a plain <form> GET submit if JavaScript is disabled.
  • Responsive breakpoints: stacked on mobile, 2 columns from tablet (≥768px), wider gutters on laptop (≥1024px) and large screens (≥1440px).
  • Customizable colors (card background, text, fields background) from Settings → Diagnostic Parfum in wp-admin.
  • WPML-ready:
    • Dynamic <title> and canonical URL, with dedicated hooks for Yoast SEO and RankMath (both plugins bypass WordPress' native title filter, so a generic document_title_parts hook alone isn't enough).
    • Per-language default pre-selected perfume family.
    • Works around a common WPML pitfall where get_terms() returns terms from every language at once unless suppress_filters is explicitly set to false.

Requirements

  • WordPress 5.8+
  • PHP 7.4+
  • WooCommerce 6.0+
  • Two WooCommerce attribute taxonomies on your products: pa_mini_diag_parfum and pa_mini_diag_note
  • (Optional) WPML, if you want multilingual support
  • A theme-level lsg_t( $fr, $en ) helper function (a minimal bilingual string helper) — or adapt the calls to your own i18n approach

Installation

cd wp-content/plugins
git clone https://github.com/Lucas-tsl/lsg-diagnostic-parfum.git

Then activate it from Plugins in wp-admin.

Configuration

Open lsg-diagnostic-parfum.php and adjust, near the top of the file:

define( 'LSG_DIAG_DEFAULT_PARFUM', 'reconfortant' ); // base/default-language slug

function lsg_diag_default_parfum_by_lang() {
    return apply_filters( 'lsg_diag_default_parfum_by_lang', array(
        'fr' => 'reconfortant',
        'en' => 'comforting',
    ) );
}

Usage

On a category page: insert the custom/diag block into your category template via the Site Editor.

On a standalone page: create a page and add:

[lsg_diag_parfum]

License

GPL v2 or later — see LICENSE.