# Hide Prices Until Login Plugin

A Shopware 6 plugin that hides product prices from non-logged-in users until they log in to their account.

## Features

- Hides all product prices for non-logged-in users
- Removes price ranges and "from" prices
- Handles variant products correctly
- Works with the standard Shopware 6 product templates
- Adds a flag to identify hidden prices in templates

## Installation

1. Download the plugin
2. Upload it to your Shopware 6 installation in the `custom/plugins` directory
3. Install the plugin through the Shopware 6 Administration or using the command line:
   ```bash
   bin/console plugin:install HidePricesUntilLogin
   bin/console plugin:activate HidePricesUntilLogin
   ```
4. Clear the cache:
   ```bash
   bin/console cache:clear
   ```

## Usage

The plugin works automatically after installation. It will:
- Hide all product prices for non-logged-in users
- Show prices only after a user has logged in
- Handle both regular products and variant products
- Remove all price-related information including ranges and "from" prices

## Technical Details

The plugin uses the `sales_channel.product.loaded` event to intercept product loading and modify price information. It:
- Checks if the current user is logged in
- For non-logged-in users, removes all price information
- Sets a flag (`hidePrices`) that can be used in templates to show/hide price-related UI elements

## Template Integration

If you want to show/hide additional price-related elements in your templates, you can check the `hidePrices` extension:

```twig
{% if product.extensions.hidePrices.hidden %}
    {# Show login prompt or other content #}
{% else %}
    {# Show price information #}
{% endif %}
```

## Requirements

- Shopware 6.4 or higher
- PHP 7.4 or higher
