{"_id":"56d88886b159f10b00304621","category":{"_id":"56d88885b159f10b00304613","pages":["56d88886b159f10b0030461c","56d88886b159f10b0030461d","56d88886b159f10b0030461e","56d88886b159f10b0030461f","56d88886b159f10b00304620","56d88886b159f10b00304621","56d88886b159f10b00304622","56d88886b159f10b00304623","56d88886b159f10b00304624","56d88886b159f10b00304625","56d88886b159f10b00304626","56d88886b159f10b00304627","56d88886b159f10b00304628","56d88886b159f10b00304629","56d88886b159f10b0030462a","56d88886b159f10b0030462b","56d88886b159f10b0030462c","56d88886b159f10b0030462d","56d88886b159f10b0030462e","56d88886b159f10b0030462f","56d88886b159f10b00304630","56d88886b159f10b00304631"],"project":"549a321bf876ae0b00f33623","__v":1,"version":"56d88884b159f10b00304609","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-05-20T00:49:50.639Z","from_sync":false,"order":10,"slug":"developer-api","title":"Filters Reference"},"user":"549a320d5b50c21400fae689","project":"549a321bf876ae0b00f33623","version":{"_id":"56d88884b159f10b00304609","__v":3,"project":"549a321bf876ae0b00f33623","createdAt":"2016-03-03T18:55:00.567Z","releaseDate":"2016-03-03T18:55:00.567Z","categories":["56d88885b159f10b0030460a","56d88885b159f10b0030460b","56d88885b159f10b0030460c","56d88885b159f10b0030460d","56d88885b159f10b0030460e","56d88885b159f10b0030460f","56d88885b159f10b00304610","56d88885b159f10b00304611","56d88885b159f10b00304612","56d88885b159f10b00304613","56d88885b159f10b00304614","56d89250b159f10b003046d4","56da13977222d50b0070167c"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"2.2.1","version":"2.2.1"},"__v":3,"parentDoc":null,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-05-20T03:32:35.344Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":5,"body":"[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"lifterlms_get_checkout_url\"\n}\n[/block]\nFilter applied when returning the checkout url.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"apply_filters( 'lifterlms_get_checkout_url', $checkout_page_id ? get_permalink( $checkout_page_id ) : '' );\",\n      \"language\": \"php\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"lifterlms_gateway_title\"\n}\n[/block]\nFilter applied to the title of a payment gateway when it is displayed.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<?php // don't copy this line if pasting into an existing php file\\n\\n/**\\n * Add a filter to change the displayed title of a payment gateway or gateways\\n * :::at:::param  string   $title  default title of the gateway (eg: \\\"Credit Card (Stripe)\\\" or \\\"PayPal\\\")\\n * @param  string   $id     id of the gateway (eg: \\\"stripe\\\" or \\\"paypal\\\")\\n * @return string\\n */\\nadd_filter( 'lifterlms_gateway_title', function( $title, $id ) {\\n\\n\\t// remove the string \\\"(Stripe)\\\" when displaying the title of the Stripe gateway\\n\\tif( 'Credit Card (Stripe)' === $title ) {\\n\\n\\t\\t$title = 'Credit Card';\\n\\n\\t}\\n\\n\\treturn $title;\\n\\n}, 10, 2 );\",\n      \"language\": \"php\",\n      \"name\": \"lifterlms_gateway_title.php\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"lifterlms_before_order_process\"\n}\n[/block]\nFilter applied to the order object before order is processed.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"apply_filters( 'lifterlms_before_order_process', $order );\",\n      \"language\": \"php\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"lifterlms_checkout_confirm_payment_url\"\n}\n[/block]\nFilter applied to the checkout confirmation redirect url.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"apply_filters( 'lifterlms_checkout_confirm_payment_url', $confirm_payment_url );\",\n      \"language\": \"php\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"lifterlms_order_process_pending_redirect\"\n}\n[/block]\nFilter applied to checkout payment pending redirect. Only called if there is an issue with the chosen API charge payment method.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"apply_filters( 'lifterlms_order_process_pending_redirect', $url ) );\",\n      \"language\": \"php\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"lifterlms_order_process_success_redirect\"\n}\n[/block]\nFilter applied to redirect after successful payment processed.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"apply_filters( 'lifterlms_order_process_success_redirect', $redirect ) );\",\n      \"language\": \"php\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"lifterlms_order_process_complete_redirect\"\n}\n[/block]\nFilter applied to the redirect if user has already completed payment. Used if user attempts to  access checkout page after successful purchase.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"apply_filters( 'lifterlms_order_process_complete_redirect', $redirect ) );\",\n      \"language\": \"php\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"lifterlms_checkout_redirect\"\n}\n[/block]\nFilter applied when returning checkout page redirect uri.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"add_filter( 'lifterlms_checkout_redirect', function( $redirect ) {\\n\\t\\n\\t// redirect user to a WordPress page with id 123 on succesful registration before checkout\\n\\treturn get_permalink( 123 );\\n\\n}, 10, 1 );\",\n      \"language\": \"php\",\n      \"name\": \"lifterlms_checkout_redirect.php\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"lifterlms_new_order\"\n}\n[/block]\nFilter applied before new order post is created.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"pply_filters( 'lifterlms_new_order', array() );\",\n      \"language\": \"php\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"lifterlms_checkout_coupon_message\"\n}\n[/block]\nApplied before returning the coupon link message on the checkout page.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"apply_filters( 'lifterlms_checkout_coupon_message', __( 'Have a coupon?', 'lifterlms' ) );\",\n      \"language\": \"php\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"lifterlms_form_checkout_cc\"\n}\n[/block]\nApplied before returning the credit card form on the checkout page. Use to add custom fields or create a new credit card form.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"apply_filters('lifterlms_form_checkout_cc', llms_get_template( 'checkout/form-checkout-cc.php', 'lifterlms') );\",\n      \"language\": \"php\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"lifterlms_checkout_message\"\n}\n[/block]\nApplied before returning custom message on checkout page.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"apply_filters( 'lifterlms_checkout_message', '' );\",\n      \"language\": \"php\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"lifterlms_confirm_payment_method_text\"\n}\n[/block]\nApplied before displaying the name of the payment method being used to process the customer's payment.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<?php\\n/**\\n * Modify the text display on the LifterLMS Confirm Payment Screen\\n * @param  string $method   default payment method text\\n * @return string\\n */\\nfunction my_confirm_payment_method_text( $method )\\n{\\n\\n\\t// only modify the text if the customer is paying via the stripe payment gateway\\n\\tif( $method == 'stripe' )\\n\\t{\\n\\n\\t\\t$method = 'Credit Card via Stripe';\\n\\n\\t}\\n\\n\\treturn $method;\\n\\n}\\nadd_filter( 'lifterlms_confirm_payment_method_text', 'my_confirm_payment_method_text' );\\n?>\",\n      \"language\": \"php\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"lifterlms_checkout_user_logged_in_output\"\n}\n[/block]\nApply custom output to the checkout form template for logged in users.\n\nPasses a single argument: checkout template\n\nYou can use this filter to append to or replace the checkout form when users are logged in.  *Also see: lifterlms_checkout_user_not_logged_in_output* \n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"lifterlms_checkout_user_not_logged_in_output\"\n}\n[/block]\nApply custom output to the checkout form for non-logged in users.\n\nPasses a single argument: Page restricted template\n\nYou can use this filter to append to or replace the page restricted template for non-logged in users. *Also see: lifterlms_checkout_user_logged_in_output*","excerpt":"","slug":"filters-checkout","type":"basic","title":"Filters: Checkout"}
[block:api-header] { "type": "basic", "title": "lifterlms_get_checkout_url" } [/block] Filter applied when returning the checkout url. [block:code] { "codes": [ { "code": "apply_filters( 'lifterlms_get_checkout_url', $checkout_page_id ? get_permalink( $checkout_page_id ) : '' );", "language": "php" } ] } [/block] [block:api-header] { "type": "basic", "title": "lifterlms_gateway_title" } [/block] Filter applied to the title of a payment gateway when it is displayed. [block:code] { "codes": [ { "code": "<?php // don't copy this line if pasting into an existing php file\n\n/**\n * Add a filter to change the displayed title of a payment gateway or gateways\n * @param string $title default title of the gateway (eg: \"Credit Card (Stripe)\" or \"PayPal\")\n * @param string $id id of the gateway (eg: \"stripe\" or \"paypal\")\n * @return string\n */\nadd_filter( 'lifterlms_gateway_title', function( $title, $id ) {\n\n\t// remove the string \"(Stripe)\" when displaying the title of the Stripe gateway\n\tif( 'Credit Card (Stripe)' === $title ) {\n\n\t\t$title = 'Credit Card';\n\n\t}\n\n\treturn $title;\n\n}, 10, 2 );", "language": "php", "name": "lifterlms_gateway_title.php" } ] } [/block] [block:api-header] { "type": "basic", "title": "lifterlms_before_order_process" } [/block] Filter applied to the order object before order is processed. [block:code] { "codes": [ { "code": "apply_filters( 'lifterlms_before_order_process', $order );", "language": "php" } ] } [/block] [block:api-header] { "type": "basic", "title": "lifterlms_checkout_confirm_payment_url" } [/block] Filter applied to the checkout confirmation redirect url. [block:code] { "codes": [ { "code": "apply_filters( 'lifterlms_checkout_confirm_payment_url', $confirm_payment_url );", "language": "php" } ] } [/block] [block:api-header] { "type": "basic", "title": "lifterlms_order_process_pending_redirect" } [/block] Filter applied to checkout payment pending redirect. Only called if there is an issue with the chosen API charge payment method. [block:code] { "codes": [ { "code": "apply_filters( 'lifterlms_order_process_pending_redirect', $url ) );", "language": "php" } ] } [/block] [block:api-header] { "type": "basic", "title": "lifterlms_order_process_success_redirect" } [/block] Filter applied to redirect after successful payment processed. [block:code] { "codes": [ { "code": "apply_filters( 'lifterlms_order_process_success_redirect', $redirect ) );", "language": "php" } ] } [/block] [block:api-header] { "type": "basic", "title": "lifterlms_order_process_complete_redirect" } [/block] Filter applied to the redirect if user has already completed payment. Used if user attempts to access checkout page after successful purchase. [block:code] { "codes": [ { "code": "apply_filters( 'lifterlms_order_process_complete_redirect', $redirect ) );", "language": "php" } ] } [/block] [block:api-header] { "type": "basic", "title": "lifterlms_checkout_redirect" } [/block] Filter applied when returning checkout page redirect uri. [block:code] { "codes": [ { "code": "add_filter( 'lifterlms_checkout_redirect', function( $redirect ) {\n\t\n\t// redirect user to a WordPress page with id 123 on succesful registration before checkout\n\treturn get_permalink( 123 );\n\n}, 10, 1 );", "language": "php", "name": "lifterlms_checkout_redirect.php" } ] } [/block] [block:api-header] { "type": "basic", "title": "lifterlms_new_order" } [/block] Filter applied before new order post is created. [block:code] { "codes": [ { "code": "pply_filters( 'lifterlms_new_order', array() );", "language": "php" } ] } [/block] [block:api-header] { "type": "basic", "title": "lifterlms_checkout_coupon_message" } [/block] Applied before returning the coupon link message on the checkout page. [block:code] { "codes": [ { "code": "apply_filters( 'lifterlms_checkout_coupon_message', __( 'Have a coupon?', 'lifterlms' ) );", "language": "php" } ] } [/block] [block:api-header] { "type": "basic", "title": "lifterlms_form_checkout_cc" } [/block] Applied before returning the credit card form on the checkout page. Use to add custom fields or create a new credit card form. [block:code] { "codes": [ { "code": "apply_filters('lifterlms_form_checkout_cc', llms_get_template( 'checkout/form-checkout-cc.php', 'lifterlms') );", "language": "php" } ] } [/block] [block:api-header] { "type": "basic", "title": "lifterlms_checkout_message" } [/block] Applied before returning custom message on checkout page. [block:code] { "codes": [ { "code": "apply_filters( 'lifterlms_checkout_message', '' );", "language": "php" } ] } [/block] [block:api-header] { "type": "basic", "title": "lifterlms_confirm_payment_method_text" } [/block] Applied before displaying the name of the payment method being used to process the customer's payment. [block:code] { "codes": [ { "code": "<?php\n/**\n * Modify the text display on the LifterLMS Confirm Payment Screen\n * @param string $method default payment method text\n * @return string\n */\nfunction my_confirm_payment_method_text( $method )\n{\n\n\t// only modify the text if the customer is paying via the stripe payment gateway\n\tif( $method == 'stripe' )\n\t{\n\n\t\t$method = 'Credit Card via Stripe';\n\n\t}\n\n\treturn $method;\n\n}\nadd_filter( 'lifterlms_confirm_payment_method_text', 'my_confirm_payment_method_text' );\n?>", "language": "php" } ] } [/block] [block:api-header] { "type": "basic", "title": "lifterlms_checkout_user_logged_in_output" } [/block] Apply custom output to the checkout form template for logged in users. Passes a single argument: checkout template You can use this filter to append to or replace the checkout form when users are logged in. *Also see: lifterlms_checkout_user_not_logged_in_output* [block:api-header] { "type": "basic", "title": "lifterlms_checkout_user_not_logged_in_output" } [/block] Apply custom output to the checkout form for non-logged in users. Passes a single argument: Page restricted template You can use this filter to append to or replace the page restricted template for non-logged in users. *Also see: lifterlms_checkout_user_logged_in_output*